1

Here is my code:

name = []
number = []

CONTACTS = [name,number]

i = True
a = 'yes'
while i == True:
    name.append(input('Please type in the name of the contact: '))
    number.append(input("Please type in the contact number: "))

    a = input('Do you want to add in any other contacts? Yes/No: ')
    if a.lower() == 'yes':
        continue
    elif a.lower() == 'no':
        i == False
    else:
        print("Type in yes/no only.")
        break

j=0;
for item in name:
    print(f'{j+1}.\nName: {name[j]}\nNumber: {number[j]}\n')
    j+=1

I wish to get back from this part

    else:
        print("Type in yes/no only.")
        break

to the part where I take input for a (yes/no option).
If I use continue then it will begin from the top of the loop, then what should I do?

h4kr
  • 238
  • 1
  • 3
  • 13

0 Answers0