- Input a string
name = input("Enter your name: ")
print("Your name is:", name)
- Input a number (error!)
x = input("Enter a number: ")
print("One half of", x, "=", x/2) # Error!
- Input a number with int()
x = int(input("Enter a number: "))
print("One half of", x, "=", x/2)