[Tutor] Newbie question re: user interaction
Fri, 2 Feb 2001 02:28:51 +0100
Content-Type: text/plain; charset=iso-8859-1
Sez First Name Last Name:
> 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$ "!"
n =3D raw_input("What is your name?")
print "Hello,", n
Note that there's no space in the "Hello," string. The print statement adds
one space between each comma separated argument:
>>> print "a", "b", "c"
a b c
Also, a good idea is to check out the built in functions, there are quite a
few nice tools there:
And indeed, the library reference is your friend:
> Please tell me I'm wrong!
You're wrong! <wink>
P.S. I might add that local time is 02:28 (AM). I really should go to bed.
Email: firstname.lastname@example.org | You can tune a filesystem, but you
Web: http://www.gnupung.net/ | can't tune a fish. -- man tunefs(8)
PGP fingerprint: 0C56 B171 8159 327F 1824 F5DE 74D7 80D7 BF3B B1DD
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org
-----END PGP SIGNATURE-----