Page 1 of 1

Python: Logical Operator "or" (Exclusive Probability)

Posted: Fri Apr 10, 2026 1:22 pm
by Jason
Note: There is no Python operator showing Inclusive Probability, that would be where one or the other or both are the correct choice, so in this case, only one or the other, but not both can be correct (Exclusive Probability).

Code: Select all

print("Let's see if you can pick one out of two unknown positive numbers under 6.")

try:

	the_chosen_number = int(input("Pick the number:"))

	if(the_chosen_number == 5 or 1):

		print("You chose one out of the two correct numbers which  were 5 or 1.")
		
except ValueError:

	return "Please pick an integer."

else:

	print("Sorry, you didn't get one of the correct numbers.")