0

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

Jane
  • 7
  • 1
  • Does this answer your question? [How can I read inputs as numbers?](https://stackoverflow.com/questions/20449427/how-can-i-read-inputs-as-numbers) – DollarAkshay Mar 19 '22 at 07:25

1 Answers1

0

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

Vishnu S
  • 24
  • 6