#Author: Maheen Hannan
#Date & Time: 13/10/2015 12:32PM
#Purpose: Mark to grade converter
# import time to control flow of time within the program.
import time
# print command to output text to the terminal.
print('Welcome to Marks-to-Grade Conversion program prowered by Python 3.4')
print ()
print ('Note:')
print ('Grades are U -> A')
print('Mark minimum is 0, maximum is 100')
print ()
# 'n' as a variable for name input, input to allows user input.
# 'input' is given so that the user is allowed to enter an input.
n = input('Enter your name: ')
# while True command used to define a correct input.
while True:
# If an error is expected it will stop tranfer.
try:
print ()
# 'm' is the variable for the amount of marks inputted by the user.
# 'int' is used so that the inputted number will be an interger.
m = int(input('Enter your mark: '))
print ()
# When a character is entered that it is not a number it will return with an
error.
except ValueError:
# '\' is gien so that the word 'not' is not given as a function.
print ('That\'s not a number!')
# If a character is entered that is a number it will flow into this string of
options.
else:
# 'if' is given so that when a number is entered a sepecific result will be
given.
# '? < 'int(m)' < ?' is given to create a range of numbers.
if -1 < int(m) < 101:
if -1 < int(m) < 40:
# '(?-(m))' is given so that it can calculate the difference
between a number and the given number by the user.
print ((n),'you have received Grade U.', 'You were', (40-(m)),
'away from Grade E.')
# 'time.sleep' is given to end the program after a given amount of
seconds.
time.sleep (3)
# Stop the script.
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller SNK0. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $6.44. You're not tied to anything after your purchase.