Conditioning Statements


In [28]:
#If condition
x = 10
if (x<=10):
    print 'True'


True

In [40]:
# If-Else condition

x = 5
if x>4:
    print'True'
else:
    print 'False'


True

In [5]:
# If-elif
x = False

if x == True:
    print'True'
elif x==False:
    print 'False'


False

In [42]:
#If-elif-else
print 'This application converts your from percentage to A, B,C,D'
grade = input('Please enter your grades:  ')

if (grade >= 85):
    print 'A'
elif (75 <= grade < 85):
    print 'B'
elif (65 <= grade < 75):
    print 'C'
elif (50 <= grade < 65):
    print 'D'
else:
    print 'F'


This application converts your from percentage to A, B,C,D
Please enter your grades:  10
F