My Program (Current)

Here is where I post the source code for my projects (I almost have almost none at all). I will keep on posting updates on my current program; ''GradeBook Act!''. =) If you need help executing this code, just go to http://www.python.org/ and find out! Lines beginning with a "#"s are comments; they explain my code. If you've read my code, you can see that I talk about the Jargon File, you can find it here:

( http://catb.org/jargon/html/index.html ). Also, to help with simple school stuff, you can do division with Python easily by getting the Python interpreter, and then typing into the interpreter: divmod(x, y). Where X and Y are the numbers you want to divide by (x [divided-by] y).

Here it is:

#! /usr/bin/python
# NOTE! All letter answers are to be written in quotes (including dates)!
print """############################################
# Welcome to Gradebook! v 0.1              #
# YOUR LIGHT WEIGHT SCHOOL RECORD MANAGER! #
############################################"""
subject = raw_input("What is your assignment's subject? ")
# ^^This asks your class subject; assigns it to 'subject'; and is used later.
date = input('What is the date for your assignment? ')
# ^^This is pretty much the same: but asks the date.
amount = input('What is the number of questions? (NOTE: make all #s from now decimals. e.g.: "5.0" ')
# ^^^This is also the same, but make the number a DECIMAL!
correct = input('How many questions did you get correct? ')
# ^^^The same... make all DECIMALS!
calc = divmod(correct, amount)
#  This is a nice homework trick. Divides correct by amount, assigns to 'calc'
calcx = (correct / amount)
# divides correct by amount; assigns to 'calcx'
text = "***%s*** \n %s | %d out of %d | %s or %s \n" % (date, subject, correct, amount, calc, calcx)
# creates what will be in your file. assigns to 'text'
print text
# prints what it will put in your file (or append).
fle = raw_input('What should I name the file to put the above data into? ')
# prompts for a filename
A = input('Do you want this to be appended to an existing file? ')
# decides to either append,or to create new file. assigns answer to 'A'
print 'Thanks! appending to file... '
if A is 'yes': #if you answered yes:
fyl = open(fle, 'a')
# the phrase 'fyl' is used to combine open('fle, 'a') with future commands
fyl.write(text)
# the command assigned to 'fyl' writes your data to the filename you said.
fyl.close()
# closes the file; job is done.
elif A is 'no': # if you said no, this will happen:
fyl = open(fle, 'w')
# same as before, but saves the file (see the 'w' instead of 'a'?)
fyl.write(text)
# same
fyl.close()
# same
else: # and if nothing was valid...
print 'Error! Invalid transaction! '
# ...error message!
print 'Done!'
# says it is done
raw_input("Press <RETURN> to quit.")
# makes you type <enter> to quit.