Answer:
Here's a Python function that takes a two-digit number and checks if it's greater than its reversed digit version:
def reverseCompare(num):
if num > int(str(num)[::-1]):
print("Ok")
else:
print("Not ok")
Step-by-step explanation:
- 'str(num)[::-1]' reverses the string representation of the number using string slicing.
- 'int(str(num)[::-1])' converts the reversed string back to an integer.
- The 'if' statement checks if 'num' is greater than the reversed version.
- If the condition is true, the function prints "Ok", else it prints "Not ok".
Example Usage:
reverseCompare(72) # prints "Ok"
reverseCompare(23) # prints "Not ok"