Skip to content

Commit 31faa69

Browse files
committed
while in list
1 parent fa39ee5 commit 31faa69

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

while in list.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
numlist = list()
2+
while True:
3+
inp = input('Enter a number (Enter "stop" to stop the task): ')
4+
if inp == 'stop':
5+
break
6+
value = float(inp)
7+
numlist.append(value)
8+
average = sum(numlist) / len(numlist)
9+
print('The average is:' , average)

0 commit comments

Comments
 (0)