Advertisement
T-D-K

Untitled

Mar 23rd, 2018
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.01 KB | None | 0 0
  1. //Task1.py
  2. continueInput = True
  3. n = 0
  4. sum = 0
  5. while continueInput:
  6.     currentNumber = int(input())
  7.     if currentNumber%8==0 and currentNumber!=0:
  8.         n+=1
  9.         sum+=currentNumber
  10.     continueInput = currentNumber!=0
  11. if n==0:
  12.     print("NO")
  13. else:
  14.     print(sum/n)
  15.  
  16. //Task2.py
  17. continueInput = True
  18. n = input()
  19. i = len(n)-1
  20. while i>=0:
  21.     print(n[i], end='')
  22.     i-=1
  23.  
  24. //Task3.py
  25. continueInput = True
  26. firstMax = 0
  27. secondMax = 0
  28. while continueInput:
  29.     currentNumber = int(input())
  30.     if currentNumber!=0:
  31.         if currentNumber>secondMax:
  32.             secondMax = currentNumber
  33.         if (currentNumber>=firstMax):
  34.             secondMax = firstMax
  35.             firstMax = currentNumber
  36.     continueInput = currentNumber!=0
  37. print(secondMax)
  38.  
  39. //Task4.py
  40. import math
  41. p,q = [int(i) for i in input().split()]
  42. i = 1
  43. result = 0
  44. continueSearch = True
  45. while continueSearch:
  46.     f = math.factorial(i)
  47.     if f>=p and f<=q:
  48.         result+=1
  49.     i+=1
  50.     continueSearch = f<q
  51. print(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement