Write a program that takes in an integer in the range 11-100 as input. The output is a countdown starting from the integer, and stopping when both output digits are identical. Ex: If the input is: 93 the output is: 93 92 91 90 89 88 Ex: If the input is: 11 the output is: 11 Ex: If the input is: 9 or any value not between 11 and 100 (inclusive), the output is: Input must be 11-100 this is what i have n = int(input()) if n > 100 or n < 11: print('Input must be 11-100') exit(0) while True: print(n, end=" ") first_digit = n // 10 second_digit = n % 10 if first_digit == second_digit: break n = n-1 my output is 93 92 91 90 89 88 but it needs to be 93 92 91 90 89 88
Write a program that takes in an integer in the range 11-100 as input. The output is a countdown starting from the integer, and stopping when both output digits are identical. Ex: If the input is: 93 the output is: 93 92 91 90 89 88 Ex: If the input is: 11 the output is: 11 Ex: If the input is: 9 or any value not between 11 and 100 (inclusive), the output is: Input must be 11-100 this is what i have n = int(input()) if n > 100 or n < 11: print('Input must be 11-100') exit(0) while True: print(n, end=" ") first_digit = n // 10 second_digit = n % 10 if first_digit == second_digit: break n = n-1 my output is 93 92 91 90 89 88 but it needs to be 93 92 91 90 89 88
Chapter5: Making Decisions
Section: Chapter Questions
Problem 4PE
Related questions
Question
100%
Write a program that takes in an integer in the range 11-100 as input. The output is a countdown starting from the integer, and stopping when both output digits are identical.
Ex: If the input is:
93
the output is:
93
92
91
90
89
88
Ex: If the input is:
11
the output is:
11
Ex: If the input is:
9
or any value not between 11 and 100 (inclusive), the output is:
Input must be 11-100
this is what i have
n = int(input())
if n > 100 or n < 11:
print('Input must be 11-100')
exit(0)
while True:
print(n, end=" ")
first_digit = n // 10
second_digit = n % 10
if first_digit == second_digit:
break
n = n-1
my output is 93 92 91 90 89 88
but it needs to be
93
92
91
90
89
88
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT