What is input command in python?

0 RIAS GREMORY · June 27, 2015
I wanted to know the input command in python as I didn't see them in first couple of tutorials of python by bucky.

Post a Reply

Replies

Oldest  Newest  Rating
+1 alex constantin · June 27, 2015
value = input("What is your name: ")
0 Cardinal Coog · June 27, 2015
Here's a simple example:

print('Hello, my name is Python')
print('What is your name?')
name=input()
print('It is nice to meet you, ' + name)
0 Cardinal Coog · June 27, 2015
Kayler:

input can take a string as well. Run my example above.
0 Cardinal Coog · June 27, 2015
Kayler:

Create a new file, cut and paste my code above, click on Run, you will be prompted to save the file. Then you will see the program.
+1 alex constantin · June 27, 2015
Kayler, input() gets numbers and strings in python 3.4, you are on 2.7
0 Cardinal Coog · June 27, 2015
Thanks, Alex. I should have noticed that he's using an older version.:angel:
0 Denis Balaj · June 28, 2015
For python3 is input()
For python2 is raw_input()

for example: input("Enter your age: ") or raw_input("Enter your age: ")
0 RIAS GREMORY · June 28, 2015
Thanks,people for helping me out
0 Halcyon Abraham Ramirez · June 28, 2015
Input does not take a string only...


number = int(input("What is your number?"))


in the code above you are converting the input to an int so it isn't a string now.
+1 Millymal Mally · June 29, 2015


print('Hello, my name is Python')
print('What is your name?')
name=input()
print('It is nice to meet you {0} '  .format(name))


#for advanced string formatting



https://www.python.org/dev/peps/pep-3101/?
  • 1

Python

107,046 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator