visit
Hence, in python we have an input function: input(), to receive input from the user.
Take a look at an example.Enter any data:Happy new year!
Happy new year!
When input() function is encountered by python, the program will pause until the user enters data.
Later, any input entered by the user will be converted into a string. Let’s see another example to understand this point.
Enter any text: Have a great year ahead.
text: Have a great year ahead. , type: <class 'str'>
Enter any number: 2021
number: 2021 , type: <class 'str'>
Enter any number: 2021
number: 2021 , type: <class 'int'>
So, code along and have fun :)
Also published at //dev.to/aswin2001barath/getting-input-in-python-2ehh