Hi,
Regarding the code below
as compared to
Regarding the code below
phone_letters = ["' '","","ABC","DEF","GHI","JKL","MNO","PQRS","TUV","WXYZ"] def let_to_num(): letter = input("Enter letter: ") key = 0 while key < 10: if letter.upper() in phone_letters[key]: return key else: key = key + 1 return "Not found" print(let_to_num())What is the significance of placing the return "Not found" at the same indentation as "while key < 10:"?
as compared to
phone_letters = ["' '","","ABC","DEF","GHI","JKL","MNO","PQRS","TUV","WXYZ"] def let_to_num(): letter = input("Enter letter: ") key = 0 while key < 10: if letter.upper() in phone_letters[key]: return key else: key = key + 1 return "Not found" print(let_to_num())By doing it as per the second code, the whole code will crumble and wont work? I can't get my head around this