Hi I am a beginner for python. May I ask how do you write an input prompt that takes a single number as the input, which represents a new row. Thanks
Advertisement
Answer
In python, you can use input() to read the input from the keyboard so if you want to use it later you can use a variable to store the input
str_input = input("Enter the string")
so by using the variable str_input you can get the value for later use like for printing etc. for print the value use
print(str_input)
So if you need to read the number as input then you need to typecast because everything in python default as a string so for typecast use
num_int = int(input("Enter the number"))
So by this you can read the num