[Tutor] Newbie question re: user interaction
Rob Andrews
randrews@planhouse.com
Thu, 1 Feb 2001 15:28:16 -0600
name=raw_input("What's your name? ")
print "Hello, " + name + "!"
Something like this should do it.
Rob
----- Original Message -----
From: "First Name Last Name" <dis_gus_ted@my-deja.com>
To: <tutor@python.org>
Sent: Thursday, February 01, 2001 2:05 AM
Subject: [Tutor] Newbie question re: user interaction
> 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