I have this confirm() function defined...In confirm() there's an "elif" condition embedded in a "while" loop. When the elif statement is true, I want the interpreter to print the statement and go to the "phone_number" input prompt outside of the while loop and the function itself. The input prompt is declared before this function is called.
def confirm():
while True:
response = input("Type 'y' to confirm and 'n' to enter the number again>>>")
if response == "y":
print("Your phone number has been verified")
break
elif response == "n":
print("Let's try that again")
else:
print("Kindly enter a valid response")
digits_map = {
"0" : "Zero",
"1" : "One",
"2" : "Two",
"3" : "Three",
"4" : "Four",
"5" : "Five",
"6" : "Six",
"7" : "Seven",
"8" : "Eight",
"9" : "Nine"
}
phone_number = input("Enter your phone number>>>")
words = ""
for ch in phone_number:
words += digits_map.get(ch, "non-numeric character!") + " "
print(f"Confirm your phone number {phone_number} in words is {words}")
confirm()