[Tutor] Creating To Do List Program - Question

Alan Gauld alan.gauld at btinternet.com
Tue Oct 1 09:49:07 CEST 2013


On 01/10/13 02:25, Steven D'Aprano wrote:

> Ah, no I think I see what Rafael is trying to do! I remember those old
> BASIC listings from the 1970s where the first thing the program did was
> print out a page and a half of introductory text telling you what the
> program did and what commands to give to operate it. I reckon that's
> what he is doing.

A light bulb moment!

Rafael,
how are you running your program?

If you are running it from the Python >>> prompt then
what Steven says makes sense and what you are trying
to do makes sense too. And its the wrong way to go
about things.

What I think you are trying to do is print out a list of Python commands 
that your user can type into the >>> prompt. Is that right?

If so that is the source of the apparently severe comments you've 
received. That's not how to run a Python program. The >>> prompt is only 
for experimenting with Python, not for running programs.

We were assuming that you were typing the code into a file
(called, say, ToDo.py) and running that by double clicking
it in Explorer. Windows then starts Python in the background
and it executes the code in ToDo.py.

That way the user never has to type in any Python code.
They just respond to prompts that you create.

Now, maybe I've misread the situation but if I'm right
it would explain why you were creating a big print
statement and how you got the "program" to do something.

Can you clarify exactly how you create and run your program?

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list