()06Python
Python
1. Python
2. Python Python
3.

>1. Python   
("python3")
使Pythonver3"python3"
"python3"
$ python3
Python 3.8.10 (default, May 26 2023, 14:05:08)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
">>>"Python ("$")
Python
使Python

"Command not found"python3 "python3" ("python""python3")
Windows:
$ sudo apt install python3 -y
MacOS:
$ brew install python3

("quit()",Ctrl+D)
Python"quit()"Ctrl+D (ContrlD)
Python 3.8.10 (default, May 26 2023, 14:05:08)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()   # ()
$

"quit()"Python1
"Ctrl+D"Unix
quit()使
"Ctrl+D""Ctrl+D"2Python
MacOS"Ctrl+D"

>2. Python   
使Python

Python
Enter'>>>'Python
>>> print("Hello World!") #
Hello World! # Python
>>> help(print)
# print ('q')
>>> a=input() # a
hogehoge #
>>> print(a)
hogehoge #
>>> b=256 #
>>> c=3
>>> d=128
>>> print(b+d**c) # (**)
2097408
>>> print(d/c/b) #
0.16666666666666666 #
>>> quit() # Python
$

1101-3bcPython
Python使 x
a4aba\cdot 4(a - b)"\cdot"
a=135792467 b=246813576a = 13579246^7 b = 24681357^6
x=a4(ab)b3(ba)abx = \frac{a\cdot 4( a − b ) − b\cdot 3( b − a )}{a\cdot b}
1

>3. Python   
Python

>4. Python   
()
(1) Unix使"lesson4-01.py"
10
"#"
2 () TAB
TABTAB
while True: # 1
name=input(":") # TAB
number=eval(input(":"))
for i in range(number): # 2
if i%3==0: # 3
print("Hello, %s." % name) # 4
elif i%3==1: # 3
print("\tHey, %s!" % name) # 4
else: # 3
print("\t\tHello, World!!!") # 4

(2) "python3"
$ python3 lesson6-01.py
$ python3 ./lesson6-01.py
$ python3 lesson6-01.py
: # ()
:7 # ()
Hello, . #3
Hey, !
Hello, World!!!
Hello, .
Hey, !
Hello, World!!!
Hello, . # 7
: #
:5
Hello, .
Hey, !
Hello, World!!!
Hello, .
Hey, !
:^CTraceback (most recent call last): # Ctrl+c
File "lesson6-01.py", line 2, in #
name=input(":") #
KeyboardInterrupt #
$
(/)
Ctrl+C

使
Python
   
nanoviUnix使

()
"python3"使()
Unix
MUST
MacOSpython3Ubuntu
1. python3
$ which python3
PC
/usr/bin/python3 (Win)
/usr/local/bin/python3 (MacOS)
2. (lesson6-01.py) 1
#!/usr/bin/env python3 Win/Mac()
#!/usr/bin/python3 (Win)
#!/usr/local/bin/python3 (MacOS)
3.
$ chmod +x lesson6-01.py
4. "python3"
$ ./lesson6-01.py

Python
lesson6-01.py

>5.    
WebPage
Python (Python3.8)
Python Python (PythonPython3)
|Python-izm Python-izm ()   

2023/6/26