I am trying to figure out how to change a for loop into a while loop for this function:
def sumIt():
A=1
number=int(input('Enter a number(integer):'))
total=0.0
for counter in range(number):
total+=A
A+=1
print('The sum from 1 to the number is:',total)
averageIt(total,number)
#average sum and number
def averageIt(total,number):
print('The average of the sum and the number is:',(total+number)/2)
sumIt()
would I just say:
while number>1: