1:
for i in range (1000,10000):
i = str(i)
if int(i[3]) % 5 == 0:
print()
print(int(i), end=' ')
2:
n = int(input())
summ = 1
for i in range(1, n + 1):
summ *= abs(i)
print(summ)
3:
i = 1
a = 0
while(i <= 9999):
a += 1 / i
i += 2
i = 2
b = 0
while(i <= 10000):
b += 1 / i
print(a - b)
4:
x, m, n= map(int, input().split())
for i in range(m,n+1):
if i % x == 0:
summ *= i
5:
lst = [int(i) for i in input().split()]
count = 0
summ = 0
for i in lst:
if len(str(i)) == 1:
count += 1
summ += i
print(summ / count)
Python 3.7.2
#1
def AllFourdigitsGen():
for i in range(1000, 9999+1,5):
yield (i, i+1, i+2, i+3, i+4)
[print(' '.join([str(i) for i in group]), end = '\n') for group in AllFourdigitsGen()]
#2
Неизвестна логика, по которой задаётся следующий элемент а.
#3
def seqGen(start, stop):
for i in range(start, stop+1):
yield 1/i
print(1 - sum([i for i in seqGen(2, 9999)]) - 1/10000)
#4
import functools
m,n,X = [int(i) for i in input('enter m,n,x:\n').split()]
lst = [i for i in range(m, n+1) if i % X == 0]
print(sum(lst))
print(functools.reduce(lambda p, q: p*q, lst))
print(len(lst))
#5
n = int(input('n: '))
lst = [int(input()) for i in range(n)]
onedigit = list(filter(lambda x: (x < 10) and (x > -10), lst))
print(len(onedigit))
1:
for i in range (1000,10000):
i = str(i)
if int(i[3]) % 5 == 0:
print()
print(int(i), end=' ')
2:
n = int(input())
summ = 1
for i in range(1, n + 1):
summ *= abs(i)
print(summ)
3:
i = 1
a = 0
while(i <= 9999):
a += 1 / i
i += 2
i = 2
b = 0
while(i <= 10000):
b += 1 / i
i += 2
print(a - b)
4:
x, m, n= map(int, input().split())
summ = 1
for i in range(m,n+1):
if i % x == 0:
summ *= i
print(summ)
5:
lst = [int(i) for i in input().split()]
count = 0
summ = 0
for i in lst:
if len(str(i)) == 1:
count += 1
summ += i
print(summ / count)
Python 3.7.2
#1
def AllFourdigitsGen():
for i in range(1000, 9999+1,5):
yield (i, i+1, i+2, i+3, i+4)
[print(' '.join([str(i) for i in group]), end = '\n') for group in AllFourdigitsGen()]
#2
Неизвестна логика, по которой задаётся следующий элемент а.
#3
def seqGen(start, stop):
for i in range(start, stop+1):
yield 1/i
print(1 - sum([i for i in seqGen(2, 9999)]) - 1/10000)
#4
import functools
m,n,X = [int(i) for i in input('enter m,n,x:\n').split()]
lst = [i for i in range(m, n+1) if i % X == 0]
print(sum(lst))
print(functools.reduce(lambda p, q: p*q, lst))
print(len(lst))
#5
n = int(input('n: '))
lst = [int(input()) for i in range(n)]
onedigit = list(filter(lambda x: (x < 10) and (x > -10), lst))
print(len(onedigit))