Page 1 of 1

Python: If Statement and Boolean

Posted: Tue Apr 07, 2026 6:07 pm
by 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.")