Riju21

34_practice_factorial, run rate, alt elements

May 12th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.32 KB | None | 0 0
  1. import math
  2. import fractions
  3. # current & required run rate
  4. # ----------------------------
  5.  
  6.  
  7. # runBall = ['300 294 6', '200 100 100', '333 250 40', '118 100 180']
  8.  
  9. # def check(i):
  10. #     toli = i.split(' ')
  11. #     toInt = list(map(int, toli))
  12. #     totalBall = 300
  13. #     ballInOver = 6
  14. #     oppositionRun = toInt[0]
  15. #     currentRun = toInt[1]
  16. #     remainingBall = toInt[2]
  17. #     ballfaced = totalBall - remainingBall
  18. #     remainingOver = ballfaced / ballInOver
  19. #     currentRunRate = currentRun / remainingOver
  20. #     runRequire = (oppositionRun + 1) - currentRun
  21. #     requireRunRate = (runRequire/remainingBall)*6
  22. #     print(round(currentRunRate, 2), end=' ')
  23. #     print(round(requireRunRate, 2), end=' ')
  24.  
  25. # for i in runBall:
  26. #     check(i)
  27. #     print('\n')
  28.  
  29. # factorial
  30. # -----------
  31.  
  32. # x = [6, 10, 15]
  33.  
  34. # def check(i):
  35. #     print(math.factorial(i), end=' ')
  36. #     print('\n')
  37.  
  38. # for i in x:
  39. #     check(i)
  40.  
  41.  
  42. # alt elements ( the element one after another )
  43. # -----------------------------------------------
  44.  
  45. x = [[1, 4, 55, 66, 22, 0, 76, 11, 23, 78], [1, 2, 3, 4, 5]]
  46.  
  47. count = 0
  48.  
  49. def check(i):
  50.     for m, o in enumerate(i, start=1):
  51.         if m % 2 != 0:
  52.             print(o, end=' ')
  53.     print('\n')
  54.  
  55. for i in x:
  56.     count += 1
  57.     print('set ', count, ': ', end=' ')
  58.     check(i)
Advertisement
Add Comment
Please, Sign In to add comment