職案人

求職・歴史・仏教などについて掲載するつもりだが、自分の思いつきが多いブログだよ。適当に付き合って下さい。

Pythonを対話モード

2020年08月16日 | Python
対話モード

【開発環境】
OS:Win10(64ビット)
言語:Python3.8.5(64bit)


【対話モード】
Microsoft Windows [Version 10.0.18363.1016]
(c) 2019 Microsoft Corporation. All rights reserved.

コマンドプロンプトを起動し、コマンド「python」を実行する
C:\Users\shyok>python
Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
四則演算
>>> 10*5-3
47
>>> num = 8
>>> price = 500
>>> num * price
4000
>>>
対話モードを終了する。 [Ctrl] + [z] キーを押す
>>> ^Z
C:\Users\shyok>
ヘルプを参照
C:\Users\shyok>python
Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> help('if')
The "if" statement
******************

The "if" statement is used for conditional execution:

if_stmt ::= "if" assignment_expression ":" suite
("elif" assignment_expression ":" suite)*
["else" ":" suite]

It selects exactly one of the suites by evaluating the expressions one
by one until one is found to be true (see section Boolean operations
for the definition of true and false); then that suite is executed
(and no other part of the "if" statement is executed or evaluated).
If all expressions are false, the suite of the "else" clause, if
present, is executed.

Related help topics: TRUTHVALUE
>>>
コメント
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする