mardi 25 août 2015

Complete beginner with Elif [Python]

I tried to do the first assignment from http://ift.tt/1jqXE90

The problem is that whenever I run this program, any number I input that is greater than 0 will get:

'Your grade is: A'.

Any help greatly appreciated.

Thanks!

g = int(raw_input('Enter the grade you scored: '))
if g >= 90 & g <= 100:
 print 'Your grade is: A'
elif g >= 80 & g < 90:
 print 'Your grade is: B'
elif g >= 70 & g < 80: 
 print 'Your grade is: C'
elif g >= 60 & g < 70:
 print 'Your grade is: D'
elif g >= 50 & g < 60:
 print 'Your grade is: E' 
elif g <= 0 & g >= 49:
 print 'Your grade is: F'
else:
 print 'You can only enter an integer within the range of 0-100.'

Aucun commentaire:

Enregistrer un commentaire