mercredi 8 mars 2017

If else statement , global name not defined

def vel(y,umax,r,Rmax):
     vel_p=umax*(1-(r/Rmax)**2)

     if r<50:
        r=50-y
     else:
        r=y-50
     return 'the value of velocity in cell is %r,%r,%r,%r'%(umax,r,Rmax,vel_p)


def main ():

     y=(input('enter y'))   
     a=(input('enter the umax'))
     #b=(input('enter the r'))
     b=(r)
     c=(input('enter the Rmax'))
     print(vel(a,c,b,y))

main()

i do not understand where i should put r it gives me an error global variable r not defined

Aucun commentaire:

Enregistrer un commentaire