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
m = [] | |
for x in '0123456789abcde': | |
a = f'123{x}5' | |
b = f'1{x}233' | |
res = int(a, 15) + int(b, 15) | |
if res % 14 == 0: | |
m.append(res/14) | |
print(min(m)) |
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
a = ['15', '20', '20'] | |
# b = [int(number) for number in a] | |
# || | |
b = [] | |
for number in a: | |
b.append(int(number)) | |
print(a) | |
print(b) | |
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
a = ['15', '20', '20'] | |
# b = [int(number) for number in a] | |
# || | |
b = [] | |
for number in a: | |
b.append(int(number)) | |
print(a) | |
print(b) | |
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
file = open('17 (1).txt').readlines() | |
numbers = [int(i) for i in file] | |
m = [] | |
for i in range(0, len(numbers) - 1): | |
if numbers[i] % 3 == 0 or numbers[i + 1] % 3 == 0: | |
m.append(numbers[i] + numbers[i+1]) | |
print(len(m), max(m)) |
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
def f(x, y): | |
if x > y or x == 6 or x == 12: | |
return 0 | |
if x == y: | |
return 1 | |
if x < y: | |
return f(x + 1, y) + f(x * 2, y) + f(x + 3, y) | |
print(f(3, 16)) |
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
def s(x, a): | |
res = '' | |
while x != 0: | |
res = res + str(x % a) | |
x = x // a | |
return res[::-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
nechet = '13579' | |
k = 0 | |
for n in range(1000,10000): | |
n = str(n) | |
print([n[i] in nechet for i in range(len(n))], n) | |
if all(n[i] in nechet for i in range(len(n))): | |
n_1_2 = int(n[0]) + int(n[1]) | |
n_3_4 = int(n[2]) + int(n[3]) | |
a = [n_1_2, n_3_4] | |
a = sorted(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 itertools import product, permutations | |
words = product('егэ', repeat=3) # с повторами | |
for word in words: | |
print(word) | |
words_2 = permutations('егэ', r=3) # без повторов | |
for word in words_2: | |
print(word) |
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
file = open('9.txt').readlines() | |
k = 0 | |
for string in file: | |
string = string.split() | |
int_string = [int(number) for number in string] | |
# int_string.sort() == int_string = sorted(int_string) | |
sorted_int_string = sorted(int_string) | |
if sorted_int_string[2] < (sorted_int_string[1] + sorted_int_string[0]): | |
k += 1 | |
print(k) |
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
print('1\n2') | |
print('1\t2') | |
s = 'мама и папа' | |
print(s.split(' ')) #== print(s.split()) | |
print(s.split('\t')) #== print(s.split()) | |
print(s.split('а')) | |
print(s.split(' и ')) | |
m = [] | |
for symbol in s: |
NewerOlder