Hi there,
I am new here, so I don't know if I can post these questions over here.
I am currently working on a course for learning python and I have a question about for loops. It is a basic question, but the exercise is: You already created code with a while loop that asked the user for five numbers, and displayed their total. Create code for this task, but now use a for loop.
This is my code form the previous exercise:
from pcinput import getInteger
1 2 3 4 5 6 7 8 |
total = 0 count = 0 while count < 5 : total + = getInteger( "Please give a number: " ) count + = 1 print ( "Total is" , total ) print ( "Average is" , (total / count)) |
Thank you in advance!