add new task and new aterial

This commit is contained in:
Есения Очеретяная 2024-02-22 14:43:51 +03:00
parent d03d7244fe
commit cc28e4411b
4 changed files with 27 additions and 44 deletions

43
practica/stepik/stepik_tasks/new.py Normal file → Executable file
View File

@ -1,44 +1 @@
# n = int(input())
# v = []
# for i in range(1, n+1):
# c = min(n, i)
# n = n - c
# v += [str(i)] * c
# if n <= 0:
# break
# print(" ".join(v))
# n = int(input())
# print(" ".join([str(i) for i in range(1, n+1) for j in range(i)][:n]))
# n = int(input())
# def generator(m):
# c = 0
# for i in range(1, m+1):
# for j in range(i):
# c += 1
# if c > m:
# return
# yield str(i)
# print(" ".join(generator(n)))
# хороший код
# #!/usr/bin/env python3
# import itertools
# def generate():
# for i in itertools.count(1):
# yield from [str(i)] * i
# n = int(input('Enter n: '))
# print(*itertools.islice(generate(), n))

View File

@ -29,3 +29,27 @@ else:
t = t +s[j]+str(c)
c = 1
print(t)
# то же, что и прошлое, но наоборот из a2v5 сделать aavvvvv
t = ''
o = ''
n = 0
with open ('text.txt', 'r') as text:
s = text.readline().strip()
for i in s:
if i >= 'A':
n+=1
m=i
else:
n+=1
if n == (int(len(s))):
b = m*(int(i))
t+=b
break
o+=i
if s[n] >= 'A':
b = m*(int(o))
o = ''
t+=b
with open ('test.txt', 'w') as text:
text.write(t)

View File

@ -0,0 +1 @@
SSSSSttttttttttttttoooooohhhhhhhhhhSGGGGGGGGGGGGGGGGGGGGvvvvvvvvvvMMMMMMMMMMMMMMMMMNNNNNNNNNNNNNNNNNNNNkkkkkkkkkkkksssssssssscVVVVVVVVVVVVVVVVSSSSSSSSSSSSSSSSSSFFFFFOOOOEsssssssssssssssssssTTTTTTTTTTTTTTTTTTDDDDDDDDDDDDssssssssQQQkkkkkkkkkkkkkkkkkkuuuuuuuuuuSSSSSSSSEEEEEEKKKKKKKFFFFFFFFFFFFFFggggggggghhhhhhhhhhhhhhhhhhssssssstttttttttttttttCCCCCCS

View File

@ -0,0 +1 @@
S5t14o6h10S1G20v10M17N20k12s10c1V16S18F5O4E1s19T18D12s8Q3k18u10S8E6K7F14g9h18s7t15C6S