32 = 2^5 なので、
<< 1 とすると数値は2倍され、
>> 1 とすると数値が2分の1となる。
例
print(32 << 0)
print(32 << 1)
print(32 >> 1)
結果
32 64 16
雑記
投稿日:
32 = 2^5 なので、
<< 1 とすると数値は2倍され、
>> 1 とすると数値が2分の1となる。
print(32 << 0)
print(32 << 1)
print(32 >> 1)
32 64 16
執筆者:seyanen
関連記事
matplotlib でcsv ファイルを読み込むとき、最初の行をスキップする方法
numpy の loadtxt で読み込む行を省略したい場合 スキップしたい行を # 等の記号でコメントアウトして、 loadtxt の comments = ‘#’ とすると …
annotate を使う。 例 import numpy as np from matplotlib import pyplot as plt x = np.linspace(-10,10,100) …
set size square または、その省略形で set size sq というコマンドを使えば正方形の中にグラフを描くことができる。 例 set size square plot cos(x) …
y軸に、2種類のグラフを異なるスケールでプロットする。 matplotlib axes の twinx() を使う。 https://matplotlib.org/stable/api/_as_gen …
2023/01/18
matplotlib のグラフ作成と gnuplot との対応 比較
2022/10/14
pythonで配列(リスト)の、ある要素がわかっているときにその次の要素を取得する方法。