Page 1 of 1

Python: Input Statements

Posted: Wed Apr 08, 2026 11:07 pm
by Jason

Code: Select all

try:

	your_car_brand = input("What is your car brand?")

	your_car_age = int(input("What is your car age, in years?"))

	# Input function only accepts strings unless 

	#.there is typecasting

except VaueError:

	return "Please pick an integer."

else:

	print(f"Your car brand is {your_car_brand} and your car age is {your_car_age}.")