(Textbook P241, Q52): Write a program that prompts the user to enter a six-digit number such that the digits are in order, for example, 123789. The program loops until a correct value is entered.

Respuesta :

Answer:

def numCheck(num):

#this function takes a string representing a number as argument

#returns true if all digits are strictly increasing, false otherwise

for i in range(1,len(num)):

if num[i]<=num[i-1]:

return False

return True

num=input('Enter a six digit number: ')

while len(num)!=6 or not numCheck(num):

print('Incorrect value!! Plese enter again')

num=input('Enter a six digit number: ')

ACCESS MORE