Page 1 of 1

Python: Logical Operator "and"

Posted: Fri Apr 10, 2026 1:32 pm
by Jason

Code: Select all

print(Let's choose two positive numbers under 4, in a certain order I had in mind.")

try:

	first_choice_for_number = int(input("Choose the first number.:"))

	second_choice_for_number = int(input("Choose the second number:"))
	
except ValueError: 

	return "Sorry, what is entered must be integers."
	
else:

	if(first_choice for number == 3 and second_choice_for_number == 2):

		print("You chose the correct ones in the
		correct order of 3 and then 2.")
		
	else

	print("Sorry, you missed the correct ones in the correct order.")