-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexercise3.py
More file actions
26 lines (18 loc) · 853 Bytes
/
exercise3.py
File metadata and controls
26 lines (18 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
count = ""
numbers=[]
while (not count.isdecimal()):
count = input("Please enter how many number you going to enter: ")
for i in range(int(count)):
number = input("please enter a number:")
numbers.append(float(number))
max_number=max(numbers)
min_number=min(numbers)
total=sum(numbers)
print(f'The max number is {max_number} and position at {numbers.index(max_number)}')
print(f'The min number is {min_number} and position at {numbers.index(min_number)}')
print(f"The total is {sum(numbers)}")
print(f'The average number is {sum(numbers)/len(numbers)}')
# print("The max number is", max(numbers), "and position at", numbers.index(max(numbers)))
# print("The min number is",min(numbers), "and position at", numbers.index(min(numbers)))
# print("The total is", sum(numbers))
# print("The average number is", sum(numbers)/len(numbers))