[Tutor] Creating To Do List Program - Question
Dominik George
nik at naturalnet.de
Mon Sep 30 15:29:40 CEST 2013
Hi Rafael,
> > Your original program had some code that interacted with the user. So
> > when you went from that to a giant print statement, I, and proably many
> > others, thought you were just kidding.
>
> I noticed that, but I was serious about that. I mean, my giant print
> statement was really ridiculous to say the least but it did what I
> wanted the program to do - adding items to the To Do List and printing
> that list. However, I knew this was my very first iteration and I
> wanted to improve my program by making those incremental baby steps.
That still doesn't explain why you only have a print() statement print
Python statements, rather than execute these Python statements.
> > Are you using Python 3.3, under Windows?
>
> Python 3.0 under Windows.
Why, exactly?
> > Can you write code in a function, have it take parameters and return
> > results? Do you know how to call such a function?
>
> Yes.
Then do it, I'd suggest.
> > Do you know what a file is? Do you know the difference between text
> > file and binary file? Can you read a text file into a list? Can you
> > write a list of strings out to a text file?
>
> I worked with text files yet, I have to admit I haven't worked with
> binary files though - and I don't know yet what they are. But I will
> figure that out.
That's basically any file that contains, or is supposed to contain,
non-printable characters, or where \n has another meaning than
liebreaking. You normally read a plaintext file line by line and a
binary file byte by byte.
> > If you understand all these pieces, you're probably ready to try to
> > construct a todo list program. If not, I second the suggestion to
> > follow a tutorial, till it's covered at least all of these.
>
> Ok, cool.
OTOH, *if* your claim that you understand the concepts mentioned by Dave
isn't an ill-minded overestimation, I wonder why you don't go and use
these skills. Doyou lack a concept of how to logically build up your
code, or what's the main issue?
> Ok, so I will rewrite that To Do list as you (and the others)
> suggested and I will get back to you in case I have any further
> questons.
That's good ☺!
> > Once you think you have the function written, write a simple top-level
> > program that calls the function and prints the results. Then have it
> > print the results one line at a time.
>
> I don't understand yet what a top-level program is, but I will figure that out.
The thing the python interpreter calls, that is not in a class:, def: or
some other block.
> Again, thank you all.
> I have a fairly good understanding of how I should proceed now.
You're welcome back with your results ☺!
-nik
--
<burny> Ein Jabber-Account, sie alle zu finden; ins Dunkel zu treiben
und ewig zu binden; im NaturalNet, wo die Schatten droh'n ;)!
PGP-Fingerprint: 3C9D 54A4 7575 C026 FB17 FD26 B79A 3C16 A0C4 F296
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 905 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/tutor/attachments/20130930/682dec50/attachment-0001.sig>
More information about the Tutor
mailing list