Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this program, you will check whether two dominoes match. Three dominoes. The first domino has a 1 on the left and a 5 on

In this program, you will check whether two dominoes match.
Three dominoes. The first domino has a 1 on the left and a 5 on the right. The third domino has a 3 on the left and 2 on the right. The second domino has a 5 touching the 5 on the first domino and a 3 touching the 3 on the third domino.
Because you can rotate a tile, two tiles match if the number on the left or right matches the left or right on the other tile. For example, the domino 2|1 maches the domino 1|3 without rotating either, and 2|1 matches 2|3 after flipping the first domino.
You should print all matches. First check a direct match, then try rotating tiles. But don't flip a tile whose left and right numbers are the same. If there is no match, print "No match".
Don't restructure the code. Fill in a condition for each of the if # Your code goes here statements. Empty print statements are included for output formatting.print("First domino.")
left1= int(input("left value: "))
print()
right1= int(input("right value: "))
print()
print("Second domino.")
left2= int(input("left value: "))
print()
right2= int(input("right value: "))
print()
matched = False
flip1= left1!= right1
flip2= left2!= right2
if # Your code goes here :
print("Match without flipping")
matched = True
if # Your code goes here :
print("Match after flipping first domino")
matched = True
if # Your code goes here :
print("Match after flipping second domino")
matched = True
if # Your code goes here :
print("Match after flipping both dominos")
matched = True
if # Your code goes here :
print("No match")

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 2 Lncs 13427

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124251, 978-3031124259

More Books

Students also viewed these Databases questions