can this be implemented?

G

greenflame

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.
 
D

Dan Bishop

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.
 
G

greenflame

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!
 
G

Gabriel Genellina

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top