Last active
May 12, 2016 13:53
-
-
Save alarsyo/862cde8f87cd15005a4b515dbdf1e8a1 to your computer and use it in GitHub Desktop.
List 9 python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def checkValidlist9AB(n): | |
a = n // 10 | |
b = n % 10 | |
return (a != b) | |
def checkValidlist9(n): | |
return (n > 9 and n < 100) | |
def list9(n): | |
if n == 9: | |
print(9) | |
else: | |
a = n // 10 | |
b = n % 10 | |
print(n) | |
return list9(abs((b * 10 + a) - n)) | |
x = int(input("n ? ")) | |
if checkValidlist9(x): | |
if checkValid9AB(x): | |
list9(x) | |
else: | |
print(0) | |
else: | |
print("The number you gave is invalid") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment