Re: [Tutor] I've run into a jam on the exercise on file I/O

2005-08-03 Thread Nathan Pinno
else: print "Student not found" elif menu_choice == 5: filename = raw_input("Filename to load: ") load_grades(students,filename) elif menu_choice == 6: filename = raw_input("Filename to save: ") save_grades(s

Re: [Tutor] I've run into a jam on the exercise on file I/O

2005-08-03 Thread Nathan Pinno
n Pinno" <[EMAIL PROTECTED]>; "Yoo, Danny" <[EMAIL PROTECTED]>; "Bark, Adam" <[EMAIL PROTECTED]> Cc: "Tutor" Sent: Tuesday, August 02, 2005 1:43 AM Subject: Re: [Tutor] I've run into a jam on the exercise on file I/O > >> What if I

Re: [Tutor] I've run into a jam on the exercise on file I/O

2005-08-02 Thread Alan G
> What if I were to use ID's for the students and use the ID's as the > sequence > index, and link the students and their grades to the IDs? Its not necessary for what you are doing but it's how you'd normally do it in a relational database, so if you ever needed to turn your file based progra

Re: [Tutor] I've run into a jam on the exercise on file I/O

2005-08-01 Thread Nathan Pinno
lt;[EMAIL PROTECTED]> Cc: "Tutor" Sent: Monday, August 01, 2005 3:03 PM Subject: Re: [Tutor] I've run into a jam on the exercise on file I/O > > > On Mon, 1 Aug 2005, Nathan Pinno wrote: > >> I've seem to run into a jam while working on the exercise on file

Re: [Tutor] I've run into a jam on the exercise on file I/O

2005-08-01 Thread Danny Yoo
On Mon, 1 Aug 2005, Nathan Pinno wrote: > I've seem to run into a jam while working on the exercise on file I/O. > Here's the error: > Filename to save: university.txt > Traceback (most recent call last): > File "D:\Python22\grades.py", line 99, in ? > save_grades(students,filename) > Fi

Re: [Tutor] I've run into a jam on the exercise on file I/O

2005-08-01 Thread Adam Bark
No sorry scratch that last one I was being stupid. The key is a string but max_points is a list so the list index max_points[x] is effectively looking for max_points[student]. def save_grades(students,filename):     out_file = open(filename, "w")     for x in students.keys():     out_file.w

Re: [Tutor] I've run into a jam on the exercise on file I/O

2005-08-01 Thread Nathan Pinno
Maybe I should use assignments instead? - Original Message - From: Adam Bark To: Nathan Pinno Cc: tutor@python.org Sent: Monday, August 01, 2005 2:47 PM Subject: Re: [Tutor] I've run into a jam on the exercise on file I/O >>> max_points = [2

Re: [Tutor] I've run into a jam on the exercise on file I/O

2005-08-01 Thread Adam Bark
>>> max_points = [25,25,50,25,100] >>> assignments = ['hw ch 1','hw ch 2','quiz   ','hw ch 3','test'] >>> students = {'#Max':max_points} >>> students {'#Max': [25, 25, 50, 25, 100]} The problem is the key in students is a list not an integer.On 8/1/05, Nathan Pinno <[EMAIL PROTECTED] > wrote:

[Tutor] I've run into a jam on the exercise on file I/O

2005-08-01 Thread Nathan Pinno
Hey all, I've seem to run into a jam while working on the exercise on file I/O. Here's the error: Filename to save: university.txtTraceback (most recent call last):  File "D:\Python22\grades.py", line 99, in ?    save_grades(students,filename)  File "D:\Python22\grades.py", line 51, in save_