Eliminate duplicate input call


  • We can use the while True construct to avoid this duplication.


examples/loops/single_input_call.py

while True:
   id_str = input("Type in your ID: ")
   if len(id_str) == 9:
       break

print("Your ID is " + id_str)