[Tutor] Newbie question re: user interaction

D-Man dsh8290@rit.edu
Thu, 1 Feb 2001 16:53:27 -0500


N = raw_input( "What is your name? " )
print N

:-)

(though I would use a variable like "name" instead of N)

-D


On Thu, Feb 01, 2001 at 12:05:25AM -0800, First Name Last Name wrote:
| Hello,
|     I'm a clueless newbie who has been self-teaching Python (and programming) for approximately one week.  I have made my stab at immortality by writing a random-name generator and submitting it to the Useless Python Scripts page.
| 
| Anyway, I understand enough of Python to look up the bits I don't remember in the manual, write simple functions, &c.  The part in my manual (O'Reilly 'Learning Python') about classes is complete gibberish to me, but I'm sure that will change in time.
| 
| Anyway, what I'm writing to ask about is, how do I do the equivalent of the following BASIC function in Python?
| 
| 10 INPUT "What is your name?" N$
| 20 PRINT "Hello, " N$ "!"
| 
| This is a staggeringly simple piece of code and I instinctively feel that a well-designed language like Python must have a simple and elegant way of replicating it.  However, all I've managed to gather from the manual is that if I do something horribly complicated with the cmd module then I might be able to do something that vaguely mimics the code above.  Please tell me I'm wrong!
| 
| Thanks very much for any help, Gus Hungerford.
| 
| 
| 
| ------------------------------------------------------------
| --== Sent via Deja.com ==--
| http://www.deja.com/
| 
| 
| 
| _______________________________________________
| Tutor maillist  -  Tutor@python.org
| http://mail.python.org/mailman/listinfo/tutor