Instantly share code, notes, and snippets.

View 1to9calc.py
for i in range(6561): #6561=3^8
numli = [1,2,3,4,5,6,7,8,9] #計算式に出てくる数字
calcli = [] #+を0,-を1,xを2として3進法8桁で演算子を表す
while i != 0:
calcli.append(int(i%3))
i = int(i/3)
if(len(calcli)<8): #8桁に足りない部分は全部0にする
for j in range(8-len(calcli)):
calcli.append(0)
calcli.reverse() #全通り試すのでなくてもいい
View 02.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
s = "".join(i+j for i, j in zip('パトカー', 'タクシー'))
print(s)
View 01.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
letters = "パタトクカシーー"
print(letters[::2])
View 00.py
#!/usr/bin/env python3
letters = "stressed"
print(letters[::-1])