1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| minvalue = min(10,2,3,7)
print(minvalue)
evalvalue = eval('3\*5-2');
print(evalvalue)
from itertools import permutations from itertools import combinations from itertools import product from itertools import combinations_with_replacement
dataaa = ['a','b','c']
print(list(permutations(dataaa,3))) print(list(combinations(dataaa,2)))
print(list(product(dataaa,repeat=2)))
print(list(combinations_with_replacement(dataaa,2)))
from collections import Counter
counter = Counter(['red','blue','red','green','blue','blue'])
print(counter['blue']) print(counter['green']) print(dict(counter))
import math
def lcm(a,b): return a\*b // math.gcd(a,b);
v = 21 j = 14
print(math.gcd(v,j)) print(lcm(v,j))
|