Q.Write a program to print grade of any students
"""Write a program to print grade of any students """
m=eval(input("Enter your marks:")) #m is marks
if m>=90:
print('Your grade is A.')
elif m>=80:
print("Your grade is B.")
elif m>=70:
print("Your grade is C.")
elif m>=60:
print("Your grade is D.")
else:
print("Your are not passed.")
OUTPUT:
>>>Enter your marks:85
>>>Your grade is.B
In this Program you have to understand only if elif and else structure. You have to follow given below steps:
1) First understand the program and use input function to take input from the user.
2) Next test the conditions using if, elif and else structure, if first test is true than it will print otherwise it will go to check the test for another line.
3) Similarly where the test is true that thing it will print.
Write a program to print grade of any students using python
Reviewed by Shubham Prajapati
on
February 09, 2021
Rating:
Helpful
ReplyDeleteHelpfull
ReplyDelete