Advertisement
Guest User

Untitled

a guest
Oct 21st, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. #(f.1)
  2. print("f.1")
  3. def alphabetical(rest: list)->list:
  4. return sorted(rest)
  5. print(alphabetical(RC))
  6.  
  7. #(f.2)
  8. print("f.2")
  9. def alphabetical_names(rest: list)->list:
  10. rest.sort
  11. name_list= []
  12. for d in rest:
  13. name_list.append(d.name)
  14. return name_list
  15. print(alphabetical_names(RC))
  16.  
  17. #(f.3)
  18. print("f.3")
  19. def all_Thai(rest: list)->list:
  20. result = []
  21. for t in rest:
  22. if t.cuisine=="Thai":
  23. result.append(t)
  24. return result
  25. print (all_Thai(RC))
  26.  
  27. #(f.4)
  28. print("f.4")
  29. def select_cuisine(rest: list, c: str) -> list:
  30. result = []
  31. for l in rest:
  32. if l.cuisine == c:
  33. result.append(l)
  34. return result
  35. print(select_cuisine(RC, "burgers"))
  36.  
  37. #(f.5)
  38. print('f.5')
  39. def select_cheaper(rest: list, max: float) -> list:
  40. result = []
  41. for x in rest:
  42. if x.price < max:
  43. result.append(x)
  44. return result
  45. print(select_cheaper(RC, 5.00))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement