l=[x for x in range(10)]
print(l)
ls=[str(x) for x in range(10)]
print(ls)
la=[x for x in 'abcdefg']
print(la)
sum=0
for x in range (len(ls)):
print(ls[x],end=' ')
sum+=int(ls[x])
print(f'\nsum={sum}')
for x in range (5):
for y in range(5):
print(str(x)+str(y),end=' ')
for x in range (3):
for y in range(3):
for i in range(3):
if x!=y!=i:
print(str(x)+str(y)+str(i),end=' ')
for x in range (10):
res='123'+str(x)+'789'
print(res, end=' ')
print(f'123{str(x)}789')
stri='123'
for x in stri:
sum+=int(x)
print(sum)
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n - 1)
print(factorial(5),'\n')
st='123456789'
print(st[2:-2])
print(st[2:len(st)-2],'\n')
print(bin(100))
for i in range(10):
print(bin(i)[2:], bin(i)[1], int(bin(i)[2:],2))
n = 3
m = 2
a = [[0] * m for i in range(n)]
print(a)
s=[]
print(s)
for x in range(3):
for y in range(3):
s.append(str(x)+' '+str(y))
print(s)
for i in range(len(s)):
s[i]=s[i].split()
print(s)
s=[]
print(s)
for x in range(3):
for y in range(3):
s.append(str(x)+' '+str(y))
print(s)
data=[]
for i in range (len(s)-1):
data.append(s[i].split())
print(data)
data[0][1]=77
print(data[0])
print(data[0][1], data[len(data)-1][1])
#отрезки
p=list(range(25,50))
q=list(range(40,75))
maxa=0
minb=100
for b in range(1,100):
for a in range(1,100):
A=list(range(a,b))
if all( ((x in q)<= (((x in p) == (x in q) or(not(x in p))<=(x in A)))) for x in range(1,1000)):
maxa=max(maxa,a)
minb=min(minb,b)
print(minb-maxa)
#с коньюнкцией досрок 2023
for a in range(1,1000):
if all( (x&39)==0 or((x&11==0)<=(not(x&a==0)))==1 for x in range(1,1000)):
print(a)
break
#досрок 2023
from itertools import product
with open('24.txt') as f:
st=f.readline()
s=list(product('QRS',repeat=2))
for i in s:
i=''.join(i)
if i in st:
st=st.replace(i,i[0]+'*'+i[i])
st=st.split('*')
print(max([len(x) for x in st]))
#поиск итерациями
a=list(range(0,100))
b=list(range(1,20))
a=b[::-1]+a
step=len(a)//10
while True:
mini=1000000
for i in range(0,len(a),step):
print(a[i],end =' ')
if a[i]<mini:
mini=a[i]
ind=i
if len(a)<=2:break
a=a[ind-step:ind+step]
step=len(a)//10
if step==0:step=1
print(a,step)
print(a,min(a))