Python: If Statement and Boolean

Post Reply
User avatar
Jason
Site Admin
Posts: 767
Joined: Sun Dec 21, 2025 8:56 pm

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.")

 

POSTREACT(ions) SUMMARY

Post Reply