Exercise: Logical operators

3.5.3.1. Exercise: Logical operators#

Write a short code that checks the value of two integers named dice1 and dice2, and that prints “You got double-six!”, “You got one six!” or “You got no six.” according to the dice values.

Hide code cell content
# Assign some values to dice1 and dice2
dice1 = 6
dice2 = 4

if (dice1 == 6) and (dice2 == 6):
    print("You got double-six!")
elif (dice1 == 6) or (dice2 == 6):
    print("You got one six!")
else:
    print("You got no six.")
You got one six!