[Tutor] Ran into a problem: Tried many different methods

Juan C. juan0christian at gmail.com
Wed Nov 30 04:24:25 EST 2016


On Wed, Nov 30, 2016 at 12:29 AM, Parish Watteau <pewatteau at gmail.com>
wrote:
>         A program that will read each player’s name and golf score as
> keyboard input, and then save these as records in a file named golf.txt.
> (Each record will have a field for the player’s name and a field for the
> player’s score.)

I believe you are totally covered by input() and open(). I suggest you to
write data like a csv inside golf.txt to make it easier for write and read,
like that:

name,score
bob donovan,50
mike smith,43
ana lyn,39

> I attempted to solve it but ran into some errors from using some methods
> from a different python version but it didn't turn out the right way. Now
I
> am stuck without a program and no where to start. Any help would be
> appreciated

Well, it would be better if you provided your old script and error
traceback, so we can see what you were thinking. Anyway, a good start would
be to first create the logic to keep getting data from user input until the
user tell you "I'm done", after you got it done you can go and start
thinking about writing to file. To tell you the truth that's a quite easy
script to do, I won't be posting the code here already because it would
make no sense. Hope you got the general idea and can start your code.


More information about the Tutor mailing list