+ 1

How to take input from user in python ...???

question says all ....

12th Jun 2017, 12:01 PM
#Happy@777
#Happy@777 - avatar
7 ответов
12th Jun 2017, 12:19 PM
Amarie
+ 4
use input() function
12th Jun 2017, 12:50 PM
Meshaal Haji
+ 3
user_input = input() just assign the input-function to a varible. When you run that code, you will be asked to input somerhing.
12th Jun 2017, 12:10 PM
Amarie
+ 3
The first line of Amarie's post *is* the example.
12th Jun 2017, 12:17 PM
Igor B
Igor B - avatar
+ 3
Returned value by input() function is always a string (Python3+, in Python<3 you must use raw_input() function), so you need to cast it to a number type value if you expect to do calculation with it: user_number = input("enter a number: ") user_number = int(user_number) # or float(number), depending on your needs print(user_number+42)
12th Jun 2017, 4:07 PM
visph
visph - avatar
+ 2
please give one example
12th Jun 2017, 12:10 PM
#Happy@777
#Happy@777 - avatar
+ 2
thanks a lot ...@Amarie ....
12th Jun 2017, 12:21 PM
#Happy@777
#Happy@777 - avatar