So we have to complete a task where we enter a digit from 20-98 (inclusive). The task is to make it so that it stops counting down (or breaks) whenever there's a same-digit number (88,77,66,55,44,33,22). I am able to make it pass tests if I enter 93, but not for other numbers (for ex. 30).
If we enter a digit (for example 93), the output would be:
939291908988
is my code so far:
x = int(input())while 20 <= x <= 98: print(x, end='\n') x -= 1 if x < 88: break elif x < 77: break elif x < 66: break elif x < 55: break elif x < 44: break elif x < 33: break elif x < 22: break elif x < 11: breakelse: print("Input must be 20-98")
I was wondering how I need to change my code so that it can apply to all numbers, and so I do0n't have to write so many if-else statements for all the possible same-digit numbers.