Answer to Question #346037 in Python for spike

Question #346037

Ravan's dream is to win tic-tac-toe championship.to accomplish this he practices alone at home to learn the strategies of the game . your task is to identify the cell where Ravan should place his third piece so that he wins the game. Assume that each cell in the tic-tac-toe board is marked with a number as shown in the below


TIC TAC TOE

0 1 2

3 4 5

6 7 8


input:

The first line of input contain two space-seperated integers representing the cells where Ravan has placed his first two pieces


output:

output should be a single line integer representing the cell where ravan should place his final piece


explanation

sample Output 1 :

ravan's first two moves are 0 and 1 so he not 2 to win the game .because it will complete the first row so the out put is 2

sample Output 2 :

ravan's first two moves are 0 and 3 so he not 6 to win the game .because it will complete the first row so the out put is 6



1
Expert's answer
2022-05-30T08:16:33-0400
first, second = map(int, input().split(' '))

third = second + (second - first)
print(third)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS