Q:

Compute average provided by user using while and if

My program is supposed to take an inputs from the user and provide the average. If the number input is less than 0 it is supposed to end. My program is stuck in a loop of asking the user to enter a number instead of computing the average.
  a=-1
    s=0
    c=0
    I=input('Please enter a number')
    I=float(I)
    while I >= 0:
         s += I
         c +=1
         I=input('Please enter a number')
         I=float(I)
    if c>0:
       a= s/c
       print(a)
    else:
        print("No input, cannon compute the average")

A:

do this
a=-1
s=0
c=0
I=input('Please enter a number')
I=float(I)
while I >= 0:
     s += I
     c +=1
     I=input('Please enter a number')
     I=float(I)
if c>0:
   a= s/c
   print(a)
else:
    print("No input, cannon compute the average")

