Question: Solve Python problem by using recursion Loops is restricted to this We suppose that a valid format has the form of A.B.C.D, where each letter
We suppose that a valid format has the form of "A.B.C.D", where each letter is a number range from 0 to 300. If a format has at least one of the following characteristics, then it is valid: 1. The first and lost digit of a format are the same 2. Any of A,B,C,D when reversed is one of the other values in A,B,C,D.(0.9 A-230, C=32, then they are reverse of each other since we drop leading Os) Write a function detect() Reads a number input from the keyboard with the prompt: Enter a format If the input is not a valid format, the error message is printed: Invalid And another number is entered again. If fails to enter a forn after 4 attenpts, return None. If enter a correct form within 4 attempts, return True, and return false otherwise. Example: nadetecto Enter a format: valid Invalid Enter a format: 321.123.000.123 and the value of n is set to True nadetecto) Enter a format: Say Invalid Enter a format: Writing Invalid Enter a format: 123.000 234 345 Invalid Enter a format: Answer 321.123.000.123 Invalid and the value of n is set to False
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
