summaryrefslogtreecommitdiff
path: root/comp/hw/110/cityProgram.py
diff options
context:
space:
mode:
Diffstat (limited to 'comp/hw/110/cityProgram.py')
-rw-r--r--comp/hw/110/cityProgram.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/comp/hw/110/cityProgram.py b/comp/hw/110/cityProgram.py
new file mode 100644
index 0000000..9a92e53
--- /dev/null
+++ b/comp/hw/110/cityProgram.py
@@ -0,0 +1,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()
+
+
+
+
+