LoginSignup
0
0

More than 1 year has passed since last update.

pythonにいろんな計算をさせる

Last updated at Posted at 2022-04-02

初めに

pythonで変数に数字を代入して計算してみる

ゴール

計算結果が出力されること

実践

>>> tax = 12.5 / 100
>>> price = 100.50
>>> price * tax
12.5625
>>> price + _
113.0625
>>> round(_, 2)
113.06

_は直前の結果を覚えている。便利

2022/04/03 コメント欄でアドバイスいただいたので追記

_が前回の結果を覚えているのは対話型インタプリタのときだけで、
スクリプトファイル実行時には覚えていないので注意が必要。

0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0