Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. mylist = ['0.976850566018849',
  2. '1.01711066941038',
  3. '0.95545901267938',
  4. '1.13665822176679',
  5. '1.21770587184811',
  6. '1.12567451365206',
  7. '1.18041077035567',
  8. '1.13799827821001',
  9. '1.1624485106005',
  10. '1.37823533969271',
  11. '1.39598077584722',
  12. '1.23844320976322',
  13. '1.57397155911713',
  14. '1.40605782943842',
  15. '1.36037525085048',
  16. '1.185',
  17. '1.22795283469963',
  18. '1.17192311574904',
  19. '1.04121940463022',
  20. '1.0133517787145',
  21. '0.986161470813006',
  22. '1.09820439504488',
  23. '1.06640283661947',
  24. '1.05764772395448',
  25. '1.02678616758973',
  26. '1.01876057166248',
  27. '1.09019498604372',
  28. '1.1665479238629',
  29. '1.07170094763279',
  30. '1.1326945725342',
  31. '1.18199297460235',
  32. '1.20353001964446',
  33. '1.00973941850665',
  34. '1.0662943967844',
  35. '1.04876624296406',
  36. '1.12447065457189',
  37. '0.954629674212134',
  38. '1.02961694279098']
  39.  
  40. '1.57397155911713'
  41. '1.40605782943842'
  42. '1.36037525085048'
  43. '1.39598077584722'
  44. '1.37823533969271'
  45.  
  46. sum(float(num) >= 1.3 for num in mylist)
  47.  
  48. True == 1
  49. # True
  50. True + True
  51. # 2
  52. False * 10
  53. # 0
  54.  
  55. sum(1 for x in mylist if float(x) >= 1.3)
  56.  
  57. a = [x for x in mylist if float(x) >= 1.3]
  58. print a
  59. print len(a)
  60.  
  61. sum(1 for x in mylist if float(x) >= 1.3)
  62.  
  63. count = []
  64. for value in mylist:
  65. num = float(value)
  66. if num >= 1.3:
  67. count.append(value)
  68.  
  69. print(count)
  70.  
  71. print(len(count))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement