Page 1 of 1

Python: Logical Operator "Or" (Exclusive Probability)

Posted: Thu Aug 28, 2025 4:36 pm
by The 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 (Inclusive 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.")