Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #(f.1)
- print("f.1")
- def alphabetical(rest: list)->list:
- return sorted(rest)
- print(alphabetical(RC))
- #(f.2)
- print("f.2")
- def alphabetical_names(rest: list)->list:
- rest.sort
- name_list= []
- for d in rest:
- name_list.append(d.name)
- return name_list
- print(alphabetical_names(RC))
- #(f.3)
- print("f.3")
- def all_Thai(rest: list)->list:
- result = []
- for t in rest:
- if t.cuisine=="Thai":
- result.append(t)
- return result
- print (all_Thai(RC))
- #(f.4)
- print("f.4")
- def select_cuisine(rest: list, c: str) -> list:
- result = []
- for l in rest:
- if l.cuisine == c:
- result.append(l)
- return result
- print(select_cuisine(RC, "burgers"))
- #(f.5)
- print('f.5')
- def select_cheaper(rest: list, max: float) -> list:
- result = []
- for x in rest:
- if x.price < max:
- result.append(x)
- return result
- print(select_cheaper(RC, 5.00))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement