Skip to content

Commit 3037548

Browse files
committed
Update ex065.py
1 parent 340267c commit 3037548

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

ex065.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# 65- Create a program that reads several integers from the keyboard. At the end of the execution, show the average of
2+
# all the values and which were the highest and lowest values read. The program should ask the user whether or not he
3+
# wants to continue entering values.
4+
response = "Y"
5+
medium = soma = amount = bigger = smaller = 0
6+
while response in "Yy":
7+
number = int(input("Enter a number:"))
8+
soma += number
9+
amount += 1
10+
if amount == 1:
11+
bigger = smaller = number
12+
else:
13+
if number > bigger:
14+
bigger = number
15+
if number < smaller:
16+
smaller = number
17+
response = str(input("Do you want to continue?")).upper().strip()[0]
18+
medium = soma / number
19+
print(f"You entered {amount} and the averege is {medium}.")
20+
print(f"The bigger is {bigger} and the smaller is {smaller}.")

0 commit comments

Comments
 (0)