Guest User

Untitled

a guest
Jan 20th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. word_dict = {
  2. 'a': 1,
  3. 'b': 2,
  4. 'c': 3,
  5. 'd': 4,
  6. 'e': 5
  7. }
  8.  
  9. dict_list = {}
  10. print('printing empty dict {}'.format(dict_list))
  11. dict_list = { key:value ** 3 for(key,value) in word_dict.items() if value % 2 == 0}
  12. basic_list_from_dict = ['shibbir {} rocks!'.format(key) for(key,value) in word_dict.items() if value % 2 == 0]
  13. print(dict_list)
  14.  
  15. print('printing basic_list {}'.format(basic_list_from_dict))
  16.  
  17. new_dict_for = { n:n**2 for n in range(10) if n % 2 == 0}
  18. print(new_dict_for)
  19.  
  20.  
  21. farenheit = {
  22. 't1': -30,
  23. 't2': -20,
  24. 't3': -10,
  25. 't4': 0
  26. }
  27.  
  28. celsius = { name: float(5/9)*(degrees - 32) for (name, degrees) in farenheit.items() if degrees % 2 == 0 if degrees == 0 }
  29.  
  30. print(celsius)
  31.  
  32. if_else_dict = { key: ('even' if value%2==0 else 'odd') for (key,value) in word_dict.items()}
  33. print(if_else_dict)
  34.  
  35. if_else_dict = { number: ('even' if number%2==0 else 'odd' ) for number in range(11)}
  36.  
  37. print(if_else_dict)
Add Comment
Please, Sign In to add comment