Grade Conversion
COMP 1010 Home > Back to Extra Labs
IntroductionCreate a program that converts a numerical grade to its corresponding letter grade. The letter grades that need assigning are (Please note that the following ranges are inclusive):
|
---|
Step 1: Get inputs/outputs needed to solve the problem
- input - Used to prompt the user for input
- mark - The mark that is to be used for the computation
Step 2: Write the program
#################################### #################################### # This program is used to convert # a mark into its approparite # letter grade ## Get mark from the user mark = input("Please enter your marks:") if (mark >= 75): print "Your grade is above average" elif (mark >= 70): print "Your grade is average" elif (mark <= 65): print "Your grade is below average" else: print "This is not a valid mark. Please input another mark."
Step 3: Contrast with Letter Grade Conversion program in Program-A-Day example
This Python program produces exactly the same result as the Java Letter Grade Conversion program in Program-A-Day.