Page 1 of 1

Python: Input Statements

Posted: Thu Jul 17, 2025 5:15 pm
by The 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}.")