summaryrefslogtreecommitdiff
path: root/comp/hw/110/cityProgram.py
blob: 9a92e5357242f98eb84ea0c5c85a47edc214f843 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Country = ["France", "UK", "Italy", "Spain"]
Capital = ["Paris", "London", "Rome", "Madrid"]

def add(country, capital):
    Country.append(country)    
    Capital.append(capital)

def remove(country):
    counter = 0
    for i in Country:
        if i == country:
            Country.pop(counter)
            Capital.pop(counter)
            break
        counter = counter+1        

def printCountry():
    counter = 0
    for i in Country:
        print(Country[counter], Capital[counter] )
        counter = counter + 1 

while True:
    query = input("add, remove, print: ")
    if query == "add":
        add(input("country: "), input("capital: "))
        printCountry()
    elif query == "remove":
        remove(input("country to remove: "))
        printCountry()
    elif query == "print":
        printCountry()