Advertisement
JkSoftware

Day 9 - Exercise 2

Nov 13th, 2021
917
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. travel_log = [
  2. {
  3.   "country": "France",
  4.   "visits": 12,
  5.   "cities": ["Paris", "Lille", "Dijon"]
  6. },
  7. {
  8.   "country": "Germany",
  9.   "visits": 5,
  10.   "cities": ["Berlin", "Hamburg", "Stuttgart"]
  11. },
  12. ]
  13. # Do NOT change the code above
  14.  
  15. #TODO: Write the function that will allow new countries
  16. #to be added to the travel_log.
  17. def add_new_country(country_, visits_, cities_):
  18.     new_country = {}
  19.     new_country["country"] = country_
  20.     new_country["visits"] = visits_
  21.     new_country["cities"] = cities_
  22.     travel_log.append(new_country)
  23.  
  24.  
  25.  
  26.  
  27. # Do not change the code below
  28. add_new_country("Russia", 2, ["Moscow", "Saint Petersburg"])
  29. print(travel_log)
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement