Page 1 of 1

Python: If Statement and Boolean

Posted: Fri Jul 25, 2025 6:30 pm
by The Jason

Code: Select all

try:

		one_plus_one = bool(input(Is one plus one two? True or False?:))
	
except ValueError:

		return "Wrong data type. Please type in True or False and be case sensitive."
	
else:

		if(one_plus_one):

		print("Your correct.")

		else:

		print("Sorry, you're incorrect.")