A Digital Age Deserves A Digital Leader

Hey Guys - Long time no, err, speak! I need help.

Hey Guys - Long time no, err, speak! I need help.

Postby GazR » Sun Jan 20, 2008 9:43 pm

So yeah! I've been working on my python all day, and I'm still none the closer.

basically, I have to write a program that reads from a text file, the text file reads as follows


gary, 90, 90, 90
steve, 90, 90, 90
adam, 90, 90, 90

the variables are

Name, Score1, Score2, Score3

I have to write a code that works out the average of the individual scores, and prints a message if one of the scores is below 40, I have no idea, any help would be great...

this is what I have so far..

Code: Select all
def FileRead():
    Welcome()
    print "This program is for reading the list file\n\n"
    infile = open("FileWrite.txt","r")
    for line in infile:
        thisLine  = line[0:len(line)-1];
        items = thisLine.split(",")
        print "Items read are: 'Name'", items[0],"'Python Score'", items[1],"'Syard Score'",items[2],"'Learn Score'",items[3]
       
       
    infile.close()
    print"\nfile loaded,"


Thanks guys, Gary.
<img border="0" src="Http://GazR88.pwp.blueyonder.co.uk/GazR.jpg" width="480" height="180">
PRO Level 3
Posts: 51
Joined: Wed Oct 20, 2004 2:04 pm
Location: England

Return to HTML, CSS, and Scripts

Who is online

Users browsing this forum: No registered users and 3 guests

cron
cron