In the heart of programming logic, we have the if statement in Python. The if statement is a conditional
that, when it is satisfied, activates some part of code. Often partnered with
the if statement are else if and else.
However, Python's else if is shortened into elif. If statements are generally coupled with variables to
produce more dynamic content.
Æ’ python command
mark = float(input('Enter your M: '))
if mark >= 80:
grade = 'A'
elif mark >= 65:
grade = 'B'
elif mark >= 50:
grade = 'C'
else:
grade = 'D'
print(grade)
√ output
Enter your M: 50
C
Sign up here with your email

ConversionConversion EmoticonEmoticon