+ 1
How to take input from user in python ...???
question says all ....
7 ответов
+ 4
use input() function
+ 3
user_input = input()
just assign the input-function to a varible. When you run that code, you will be asked to input somerhing.
+ 3
The first line of Amarie's post *is* the example.
+ 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)
+ 2
please give one example
+ 2
thanks a lot ...@Amarie ....