This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Для какого наименьшего целого числа А выражение (x ∙ y > A) /\ (x > y) /\ (x < 8) тождественно ложно, т.е. принимает значение 0 | |
| #при любых целых положительных x и y? | |
| for a in range(1,100): | |
| t=0 | |
| for x in range(1,100): | |
| for y in range(1,100): | |
| if ((x*y>a) and (x>y) and(x<8))==True: | |
| t+=1 | |
| break | |
| if t==1: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for y in range(2): | |
| for z in range(2): | |
| for w in range(2): | |
| for x in range(2): | |
| if(((x and w) or (w and z))==((z<=y) and (y<=x)))==True: | |
| print(y,z,w,x) | |
| # 1 0 0 0 | |
| # 1 0 1 0 | |
| # 1 0 1 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| x=125+25**3+5**9 | |
| t=0 | |
| while x>0: | |
| if x%5==0: | |
| t+=1 | |
| x=x//5 | |
| print(t) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| t="3"*125 | |
| while "333" in t or "999"in t: | |
| if "333" in t: | |
| t=t.replace("333","9",1) #rerlace - замена. Последний аргумент - это кол-во подстрок, коорые нужно заменить | |
| else: | |
| t=t.replace("999","3",1) | |
| print(t) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from random import randint as rnd | |
| import copy | |
| A=[rnd(0,10) for i in range(10)] | |
| print(A) | |
| B=copy.deepcopy(A) | |
| half=len(A)//2 | |
| single=A[half:]+A[:half] | |
| print(single) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from random import randint as rnd | |
| import copy | |
| A=[rnd(0,10) for i in range(10)] | |
| print(A) | |
| B=copy.deepcopy(A) | |
| C=copy.deepcopy(A) | |
| A[2],A[7] = A[7],A[2] | |
| print(A) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from random import randint as rnd | |
| A=[rnd(-10,10) for i in range(10)] | |
| def sum_pos(A): | |
| k=0 | |
| summa=0 | |
| for i in range(len(A)): | |
| if A[i]>0: | |
| k+=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from random import randint as rnd | |
| A=[rnd(-10,10) for i in range(10)] | |
| def max_nigga(A): | |
| max = -11 | |
| for i in range(len(A)): | |
| if A[i]<0: | |
| if A[i]>max: | |
| max=A[i] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Задачи Полякова | |
| ######################################### | |
| #18 | |
| def F(n): | |
| if n==1: | |
| return 1 | |
| if n>1: | |
| return 2*F(n-1) + G(n-1)-2 | |
| def G(n): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import string | |
| a=string.ascii_uppercase | |
| alphabet ="0123456789"+a | |
| def translate(num,to_base): | |
| if num<to_base: | |
| return alphabet[num] | |
| else: | |
| return translate(num//to_base,to_base)+alphabet[num%to_base] |