By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,621 Members | 1,074 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,621 IT Pros & Developers. It's quick & easy.

can this be implemented?

P: n/a
First I should start with some introductory comments.

When I first learned about programming, I started with BASIC, QBASIC
to be more accurate. While I was at that stage, I learned about the
INPUT command. I used it abundantly.

Ok so now for the actual issue.

I would like to implement something like the INPUT command from BASIC.
I failed to find something on the python website documentation for
beginners.

Thank you for your time.

Jun 2 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Jun 2, 6:54 pm, greenflame <alikakak...@yahoo.comwrote:
First I should start with some introductory comments.

When I first learned about programming, I started with BASIC, QBASIC
to be more accurate. While I was at that stage, I learned about the
INPUT command. I used it abundantly.

Ok so now for the actual issue.

I would like to implement something like the INPUT command from BASIC.
I failed to find something on the python website documentation for
beginners.
var = raw_input("Enter a value for var: ")

That gives you a string; if you want a number, convert it by using the
int or float constructor.

Jun 3 '07 #2

P: n/a
On Jun 2, 5:05 pm, Dan Bishop <danb...@yahoo.comwrote:
On Jun 2, 6:54 pm, greenflame <alikakak...@yahoo.comwrote:
First I should start with some introductory comments.
When I first learned about programming, I started with BASIC, QBASIC
to be more accurate. While I was at that stage, I learned about the
INPUT command. I used it abundantly.
Ok so now for the actual issue.
I would like to implement something like the INPUT command from BASIC.
I failed to find something on the python website documentation for
beginners.

var = raw_input("Enter a value for var: ")

That gives you a string; if you want a number, convert it by using the
int or float constructor.
Thanks a lot! That helped a lot!

Jun 3 '07 #3

P: n/a
En Sat, 02 Jun 2007 20:54:29 -0300, greenflame <al*********@yahoo.com>
escribió:
When I first learned about programming, I started with BASIC, QBASIC
to be more accurate. While I was at that stage, I learned about the
INPUT command. I used it abundantly.

Ok so now for the actual issue.

I would like to implement something like the INPUT command from BASIC.
I failed to find something on the python website documentation for
beginners.
This BASIC program:

INPUT "Your name"; z$
PRINT "Hello, "; z$

would be this in Python:

name = raw_input("Your name? ")
print "Hello,", name

raw_input is a built-in function, see
http://docs.python.org/lib/built-in-funcs.html#l2h-59

--
Gabriel Genellina

Jun 4 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.