Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Task1.py
- continueInput = True
- n = 0
- sum = 0
- while continueInput:
- currentNumber = int(input())
- if currentNumber%8==0 and currentNumber!=0:
- n+=1
- sum+=currentNumber
- continueInput = currentNumber!=0
- if n==0:
- print("NO")
- else:
- print(sum/n)
- //Task2.py
- continueInput = True
- n = input()
- i = len(n)-1
- while i>=0:
- print(n[i], end='')
- i-=1
- //Task3.py
- continueInput = True
- firstMax = 0
- secondMax = 0
- while continueInput:
- currentNumber = int(input())
- if currentNumber!=0:
- if currentNumber>secondMax:
- secondMax = currentNumber
- if (currentNumber>=firstMax):
- secondMax = firstMax
- firstMax = currentNumber
- continueInput = currentNumber!=0
- print(secondMax)
- //Task4.py
- import math
- p,q = [int(i) for i in input().split()]
- i = 1
- result = 0
- continueSearch = True
- while continueSearch:
- f = math.factorial(i)
- if f>=p and f<=q:
- result+=1
- i+=1
- continueSearch = f<q
- print(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement