-
Notifications
You must be signed in to change notification settings - Fork 0
Python
iwltwm edited this page Oct 22, 2019
·
4 revisions
- version Python 3.7
- requests
- string
- 文字列
'Single'"Double" - 出力
print('Hello World') - 四則演算
+ - * / % - 文字列の連結
"Py" + "thon" - 型変換
str(50)int("100") - 条件式
if 0 == 0:
print("always true")
elif 0 > 1:
print("always false")
else:
print("unknown")
- 真偽値 真
True偽False - 述語記号
== != > >= < <= - 論理記号
and or not - 入力
input("push any key...") - リスト
list = ["Hello", "My", "Birthday", "Is", 10, "/", 17]- 参照
list[0] - 追加
list.append(2019) - スライス記法
a = [1,2,3,4,5] s = a[1:3] (s = [1,2,3])
- 参照
- べき乗の計算で,
m = c ** d % n
と
m = pow(c, d, n)
は同じ結果を出すが,下のほうがかなり速い.