Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def all(cars):
- for i in cars:
- print(i)
- def id(cars):
- id = input()
- for i in cars:
- if i["id"] == id:
- print(i)
- def refresh(cars, id):
- for i in cars:
- if i["id"] == id:
- i["id"] = int(input("id:"))
- i["model"] = str(input("model:"))
- i["rate"] = int(input("rate:"))
- i["country"] = str(input("country:"))
- return cars
- def delete(cars):
- id = input()
- for i in cars:
- if i["id"] == id:
- del cars[id-1]
- return cars
- def number(cars):
- year = input()
- count = 0
- for i in cars:
- if i["year"] < year:
- count += 1
- print(count)
- cars = [{"id": 1, "model":"Mercedes-Benz", "year":2019, "rate":5, "country":"Germany"},
- {"id": 2, "model":"Subaru", "year":2017, "rate":5, "country":"Japan"},
- {"id": 3, "model":"Volkswagen", "year":2018, "rate":5, "country":"Germany"},
- {"id": 4, "model":"Fiat", "year":2017, "rate":4, "country":"Italy"},
- {"id": 5, "model":"BMW", "year":2019, "rate":5, "country":"Germany"}]
Advertisement
Add Comment
Please, Sign In to add comment