以前の記事で、Pythonでルーレット作成しました。 今日は作成に当たってpythonを使う中で、構文理解に時間がかかったselfやらinitをしっかり理解しようというモチベーションのもと、この記事を書いてます。やっぱ自分で説明しようとすると自分にも身に ...
オライリーのPythonチュートリアルを読んで知らなかったことを自分用メモとしてまとめておく。 対話モードでは、最後に表示した式を「_」に代入してある。 >>> price = 1000 >>> tax = 10 >>> price * (tax+100)/100 1100.0 >>> print(_) 1100.0 3.1.2 文字列 raw文字列:エスケープ用 ...
The init method in Python initializes an object's attributes at creation, setting up each instance with specific values to keep code organized and scalable. Why do Python classes always have init?