Advertisement
Guest User

Untitled

a guest
Feb 20th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. def add_nuage_word(word=[]):
  2. word.append("Nuage")
  3. return word
  4.  
  5. if __name__ == '__main__':
  6. a = add_nuage_word()
  7. b = add_nuage_word()
  8. print(" ".join(a+b) == "Nuage Nuage") # True
  9.  
  10.  
  11.  
  12. prices = {'apple': 0.40, 'banana': 0.50}
  13. my_purchase = {
  14. 'apple': 1,
  15. 'banana': 6}
  16.  
  17. def grocery_bill():
  18. my_purchase = dict(my_purchase.items() + {'apple': 2}.items())
  19. return sum(prices[fruit] * my_purchase[fruit]
  20. for fruit in my_purchase)
  21.  
  22.  
  23. if __name__ == '__main__':
  24. print(grocery_bill())
  25.  
  26.  
  27. def power_generator():
  28. return [(lambda x: x ** i) for i in range(5)]
  29.  
  30. if __name__ == '__main__':
  31. for power in power_generator():
  32. print(power(2)) # expected output: 2^0 2^1 2^2 2^3 2^4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement