id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

konstans@stuy.edu all > magicPair
prev  |  next  |  chance

Magic Pair - return True when the parameters form a magic pair, false otherwise. Parameters a and b will be 2 digit numbers. In order to be a magic pair, at least one of the two digits of parameter a must match one of the two digits of parameter b. If there are any matching digits, the numbers are a magic pair only if the sum of the matching digits, equals the sum of the other two digits.


magicPair(12, 21) → False
magicPair(32, 51) → False
magicPair(42, 46) → True

...Save, Compile, Run (ctrl-enter)

def magicPair(a,b):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Copyright Nick Parlante 2017 - privacy