I have to save students information in a database that is keeping continuously 
track of the information. Format is as follows:
Information: <name> <course> <grade> <duration>

Note: if this name already exists there in database, just update the 
information of that(name) e.g course,grade and date. Otherwise, add it.

What I think:

Database={}           #First Created a dictionary that will keep track
z = "Enter student name, course, grade and duration: "
line = raw_input(z)   
while (line != "quit"):
    data = line.split()
    name = data[0]
line = raw_input(z)   

This is just part because this is what I know how to do, for rest have no idea

The output should be like this:
{'alex': ['7', '8', '6'], 'john': ['9', '8', '7']})

Now as program will continuously prompt for input. If user enters “quit” it 
would exit. Otherwise it keeps taking input.

Now if there is already a name existing for example “alex” and his course, 
grade and duration are 7,8,6. Now in next turn of input if user again enters 
the name as alex but different entries for him e.g 9,9,9 so it should replace 
the older info by new e.g. it should replace 7,8,6 for alex by 9,9,9 and if 
user enters a entirely new name that is not in dictionary then it should be 
added to dictionary for example nancy 6 6 6 is the input then output should be:

{'alex': ['7', '8', '6'], 'john': ['9', '8', '7'],’nancy’:[‘6’,’6’,’6’]})


Kindly help.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to