Question: Python: Please Check your answer on an interpreter. The question asks to define a function that checks the digits of two numbers and if they

Python: Please Check your answer on an interpreter.

The question asks to define a function that checks the digits of two numbers and if they have any of the same digit in the same place, it will return True, otherwise False. I have developed an answer but it fails for some cases:

Python: Please Check your answer on an interpreter. The question asks to

My solution works with cases like (114, 12) and it returns True, but for (108, 7), it returns True when it should return False.

def is_swap(player_score, opponent_score): Return whether the two scores should be swapped # BEGIN PROBLEM 4 player_score_second_digit player_score /1 10 opponent_score_second digit -opponent_score // 10 if player_score > 1 and opponent score 1: if player-score % 10-opponent-score % 10 or player-score-second-digit % 10-opponent-score-second digit % 10: return True else: return False else: return False # END PROBLEM 4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!