Skip to content

Instantly share code, notes, and snippets.

@alarsyo
Last active May 12, 2016 13:53
Show Gist options
  • Save alarsyo/862cde8f87cd15005a4b515dbdf1e8a1 to your computer and use it in GitHub Desktop.
Save alarsyo/862cde8f87cd15005a4b515dbdf1e8a1 to your computer and use it in GitHub Desktop.
List 9 python
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