In this article, we would discuss how to take user input in Python 3.6 or higher versions of Python. In Python 3.6 onwards, we can use the input() function to take user input. The input() function takes a prompt as input. A prompt is a string that is printed on the user’s screen and the user provides the input on the prompt. And, the input function returns the typed input.
For example,
number = input("Number: ")
print("You entered: " + number)
The output of the above program will be:
Number: 34 You entered: 34
What should be the data type of this variable “number”? Let’s try to figure it out.
number = input("Number: ")
print("You entered: " + number)
print(type(number))
The above program will print the following output:
Number: 34 You entered: 34 <class 'str'>
As we can see, the input() function returns the types input and the data type of the returned value is a …








































0 Comments