# Getting 5 numbers from user. Adding numbers into list and finding the largest number

In this blog, we will ask user to enter any 5 numbers and display the largest number

Asking user to input any five numbers. Third line of a program contain an empty list. This empty list will be filled with values as the user enter numbers from his keyboard. Using try and except to inform user to enter only numbers and not alphanumeric characters. Loop will get break when the user types alphanumeric character with the message displayed “Please enter only numbers”

```print('Program to find largest number')
print('Please enter any 5 five numbers')
num_list = []
counter = 1
for n in range(1,6):
try:
num = int(input('Enter #%d value: '%counter))
num_list.append(num)
counter += 1

except ValueError:
break
```

Printing elements inside num_list

`print('Elements in a list : ',num_list)`

Finding largest number from the list using max() function

```max_number = max(num_list)
print('Largest number :',max_number)```

Output

```Program to find largest number
Please enter any 5 five numbers
Enter #1 value: 5
Enter #2 value: 9
Enter #3 value: 44
Enter #4 value: 66
Enter #5 value: 88
Elements in a list :  [5, 9, 44, 66, 88]
Largest number : 88```

Complete Code

```print('Program to find largest number')
print('Please enter any 5 five numbers')
num_list = []
counter = 1
for n in range(1,6):
try:
num = int(input('Enter #%d value: '%counter))
num_list.append(num)
counter += 1

except ValueError: