Friday, 29 November 2019

44 #My Zoo. Adding Values to a list. Extended

#44 My Zoo. Adding Values to a list. Deleting

animals = []
while True:
    print ('Name of animals you have. Type FFF to finish')
    newname=input()
    animals.append(newname)
    print (animals)
   
    if newname == 'FFF':
        animals.remove(newname)
        print ()
        print ('This is your list: ')
        print (animals)
        break

print()
print ('Need to add more?')
YESNO = input()
if YESNO =='yes':
    while True:
        print ('Name of animals you want to add. Type XXX to finish')
        newname=input()
        animals.append(newname)
        print (animals)
       
   
        if newname == 'XXX':
            animals.remove(newname)
            print ()
            print ('This is your list: ')
            print (animals)
            break

elif YESNO == 'no':
    print (animals)
    print ('Thank you.')

print ()
print ('Need to delete any?')
YESNO2 = input()
if YESNO2 =='yes':
    while True:
        print ('Name of animals you want to remove. Type XXX to finish')
        removeName=input()
        if removeName != 'XXX':
            animals.remove(removeName)
            print (animals)
   
        elif removeName == 'XXX':
            print ('This is your list: ')
            print (animals)
            break
     

elif YESNO2 == 'no':
    print (animals)
    print ('Thank you.')