This function checks if given age can be translated to the given required age,
# checks if age can be translated to 20 or 21
defisPossible(age:int,changedAge:int)->bool:returnage>21andage%2==changedAge%2print(isPossible(50,20))# output -> True
print(isPossible(50,21))# output -> False
print(isPossible(43,20))# output -> False
print(isPossible(66,21))# output -> False
This function returns the translated age and the base if possible,
# translates given age to 20 or 21 and prints the base
deftranslateAge(age:int):if(age>21):returnstr(20+age%2)+", in base "+str(age//2)return"Not possible to translate"print(translateAge(39))# output -> 21, in base 19
print(translateAge(32))# output -> 20, in base 16
print(translateAge(50))# output -> 20, in base 25
print(translateAge(20))# output -> Not possible to translate
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This function checks if given age can be translated to the given required age,
This function returns the translated age and the base if possible,