How do you take input from the user, and what type does it return?

Python data types and strings · Freshers

Model answer

input("Name: ") returns a string always. Convert it when you need a number: int(input()), and handle ValueError for bad input with try/except.

Learn this topic

Variables, Numbers, Text and input() in Python in the course Python for Beginners: Learn to Code with Real Projects.

Sign in to add your own answer.

More questions