Difference between revisions of "Grade Conversion"
From CompSciWiki
m |
|||
Line 10: | Line 10: | ||
|Body= | |Body= | ||
− | === | + | ===Step 1: Get inputs/outputs needed to solve the problem=== |
<li>input - Used to prompt the user for input | <li>input - Used to prompt the user for input | ||
<li>mark - The mark that is to be used for the computation | <li>mark - The mark that is to be used for the computation | ||
− | === | + | ===Step 2: Write the program=== |
{{CodeBlock | {{CodeBlock | ||
Line 37: | Line 37: | ||
}} | }} | ||
− | === | + | ===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. | This Python program produces exactly the same result as the Java Letter Grade Conversion program in Program-A-Day. | ||
}} | }} |
Revision as of 07:01, 4 April 2012
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
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."