Attention: PROnetworks has upgraded our forum from phpbb2 to phpbb3!!

Please head over to our new converted forum at: http://www.pronetworks.org/forums/

This old forum will remain 'read-only' until approximately February 2009. We look forward to seeing you at the new forum!
Author Message
GazR
PostPosted: Sun Jan 20, 2008 5:43 pm Reply with quote

PRO Level 4
 
 


Joined: 20 Oct 2004
Posts: 103
Location: England
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:

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.
 
Back to top
Back to top
Index >> Webmaster Domain & Code Room >> Hey Guys - Long time no, err, speak! I need help.

Page 1 of 1

 


Tired of the Ads? Registered users have 80% less adverts.