第一周-第06章節-Python3.5-第一個python程式 G:\Python3.7.3\python.exe G:/practise/oldboy/day1/HelloWorld.pyHelloWorld!!! Process finished with exit code 0 第一周-第07 ...
第一周-第06章節-Python3.5-第一個python程式
#!/usr/bin/env python
#-*- coding:utf-8 _*-
"""
@author:chenjisong
@file: HelloWorld.py
@time: 2019/04/15
url:https://www.liaoxuefeng.com
functions:
Software:JetBrains PyCharm 4.5.3
"""
print("HelloWorld!!!")
===========================================================
G:\Python3.7.3\python.exe G:/practise/oldboy/day1/HelloWorld.py
HelloWorld!!!
Process finished with exit code 0
第一周-第07章節-Python3.5-變數
#!/usr/bin/env python
#-*- coding:utf-8 _*-
"""
@author:chenjisong
@file: HelloWorld.py
@time: 2019/04/15
url:https://www.liaoxuefeng.com
functions:
Software:JetBrains PyCharm 4.5.3
"""
name = "chenjisong"
name2 = name
print("My name is",name,name2)
=================================================================
G:\Python3.7.3\python.exe G:/practise/oldboy/day1/HelloWorld.py
My name is chenjisong chenjisong
Process finished with exit code 0
解釋:name值為chenjisong,name將值賦給name2,所以name2也等於chenjisong ,故結果為:My name is chenjisong chenjisong
#!/usr/bin/env python
#-*- coding:utf-8 _*-
"""
@author:chenjisong
@file: HelloWorld.py
@time: 2019/04/15
url:https://www.liaoxuefeng.com
functions:
Software:JetBrains PyCharm 4.5.3
"""
name = "chenjisong"
name2 = name
print("My name is",name,name2)
print(id(name))
print(id(name2))
print("=================================")
name = "Paochege"
print("My name is",name,name2)
print(id(name))
print(id(name2))
======================================================================
G:\Python3.7.3\python.exe G:/practise/oldboy/day1/HelloWorld.py
My name is chenjisong chenjisong
54678256
54678256
=================================
My name is Paochege chenjisong
54678768
54678256
Process finished with exit code 0
解釋:name值為chenjisong,name將值賦予給name2,那麼name2值也為chenjisong,後面name的值發生改變,變成了Paochege,記憶體地址發生了改變,但是name2的記憶體地址沒有變化,所以結果是:My name is Paochege chenjisong
第一周-第08章節-Python3.5-字元編碼與二進位(略二進位)
摘抄至https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/001431664106267f12e9bef7ee14cf6a8776a479bdec9b9000
因為電腦只能處理數字,如果要處理文本,就必須先把文本轉換為數字才能處理。最早的電腦在設計時採用8個比特(bit)作為一個位元組(byte),所以,一個位元組能表示的最大的整數就是255(二進位11111111=十進位255),如果要表示更大的整數,就必須用更多的位元組。比如兩個位元組可以表示的最大整數是65535
,4個位元組可以表示的最大整數是4294967295
。
由於電腦是美國人發明的,因此,最早只有127個字元被編碼到電腦里,也就是大小寫英文字母、數字和一些符號,這個編碼表被稱為ASCII
編碼,比如大寫字母A
的編碼是65
,小寫字母z
的編碼是122
。
但是要處理中文顯然一個位元組是不夠的,至少需要兩個位元組,而且還不能和ASCII編碼衝突,所以,中國制定了GB2312
編碼,用來把中文編進去。
你可以想得到的是,全世界有上百種語言,日本把日文編到Shift_JIS
里,南韓把韓文編到Euc-kr
里,各國有各國的標準,就會不可避免地出現衝突,結果就是,在多語言混合的文本中,顯示出來會有亂碼。
因此,Unicode應運而生。Unicode把所有語言都統一到一套編碼里,這樣就不會再有亂碼問題了。
Unicode標準也在不斷發展,但最常用的是用兩個位元組表示一個字元(如果要用到非常偏僻的字元,就需要4個位元組)。現代操作系統和大多數編程語言都直接支持Unicode。
現在,捋一捋ASCII編碼和Unicode編碼的區別:ASCII編碼是1個位元組,而Unicode編碼通常是2個位元組。
字母A
用ASCII編碼是十進位的65
,二進位的01000001
;
字元0
用ASCII編碼是十進位的48
,二進位的00110000
,註意字元'0'
和整數0
是不同的;
漢字中
已經超出了ASCII編碼的範圍,用Unicode編碼是十進位的20013
,二進位的01001110 00101101
。
你可以猜測,如果把ASCII編碼的A
用Unicode編碼,只需要在前面補0就可以,因此,A
的Unicode編碼是00000000 01000001
。
新的問題又出現了:如果統一成Unicode編碼,亂碼問題從此消失了。但是,如果你寫的文本基本上全部是英文的話,用Unicode編碼比ASCII編碼需要多一倍的存儲空間,在存儲和傳輸上就十分不划算。
所以,本著節約的精神,又出現了把Unicode編碼轉化為“可變長編碼”的UTF-8
編碼。UTF-8編碼把一個Unicode字元根據不同的數字大小編碼成1-6個位元組,常用的英文字母被編碼成1個位元組,漢字通常是3個位元組,只有很生僻的字元才會被編碼成4-6個位元組。如果你要傳輸的文本包含大量英文字元,用UTF-8編碼就能節省空間:
從上面的表格還可以發現,UTF-8編碼有一個額外的好處,就是ASCII編碼實際上可以被看成是UTF-8編碼的一部分,所以,大量只支持ASCII編碼的歷史遺留軟體可以在UTF-8編碼下繼續工作。
搞清楚了ASCII、Unicode和UTF-8的關係,我們就可以總結一下現在電腦系統通用的字元編碼工作方式:
在電腦記憶體中,統一使用Unicode編碼,當需要保存到硬碟或者需要傳輸的時候,就轉換為UTF-8編碼。
用記事本編輯的時候,從文件讀取的UTF-8字元被轉換為Unicode字元到記憶體里,編輯完成後,保存的時候再把Unicode轉換為UTF-8保存到文件:
所以你看到很多網頁的源碼上會有類似<meta charset="UTF-8" />
的信息,表示該網頁正是用的UTF-8編碼。
Python的字元串
搞清楚了令人頭疼的字元編碼問題後,我們再來研究Python的字元串。
在最新的Python 3版本中,字元串是以Unicode編碼的,也就是說,Python的字元串支持多語言,例如:
>>> print('包含中文的str')
包含中文的str
對於單個字元的編碼,Python提供了ord()
函數獲取字元的整數表示,chr()
函數把編碼轉換為對應的字元:
>>> ord('A')
65
>>> ord('中')
20013
>>> chr(66)
'B'
>>> chr(25991)
'文'
如果知道字元的整數編碼,還可以用十六進位這麼寫str
:
>>> '\u4e2d\u6587'
'中文'
兩種寫法完全是等價的。
由於Python的字元串類型是str
,在記憶體中以Unicode表示,一個字元對應若幹個位元組。如果要在網路上傳輸,或者保存到磁碟上,就需要把str
變為以位元組為單位的bytes
。
Python對bytes
類型的數據用帶b
首碼的單引號或雙引號表示:
x = b'ABC'
要註意區分'ABC'
和b'ABC'
,前者是str
,後者雖然內容顯示得和前者一樣,但bytes
的每個字元都只占用一個位元組。
以Unicode表示的str
通過encode()
方法可以編碼為指定的bytes
,例如:
>>> 'ABC'.encode('ascii')
b'ABC'
>>> '中文'.encode('utf-8')
b'\xe4\xb8\xad\xe6\x96\x87'
>>> '中文'.encode('ascii')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)
純英文的str
可以用ASCII
編碼為bytes
,內容是一樣的,含有中文的str
可以用UTF-8
編碼為bytes
。含有中文的str
無法用ASCII
編碼,因為中文編碼的範圍超過了ASCII
編碼的範圍,Python會報錯。
在bytes
中,無法顯示為ASCII字元的位元組,用\x##
顯示。
反過來,如果我們從網路或磁碟上讀取了位元組流,那麼讀到的數據就是bytes
。要把bytes
變為str
,就需要用decode()
方法:
>>> b'ABC'.decode('ascii')
'ABC'
>>> b'\xe4\xb8\xad\xe6\x96\x87'.decode('utf-8')
'中文'
如果bytes
中包含無法解碼的位元組,decode()
方法會報錯:
>>> b'\xe4\xb8\xad\xff'.decode('utf-8')
Traceback (most recent call last):
...
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 3: invalid start byte
如果bytes
中只有一小部分無效的位元組,可以傳入errors='ignore'
忽略錯誤的位元組:
>>> b'\xe4\xb8\xad\xff'.decode('utf-8', errors='ignore')
'中'
要計算str
包含多少個字元,可以用len()
函數:
>>> len('ABC')
3
>>> len('中文')
2
len()
函數計算的是str
的字元數,如果換成bytes
,len()
函數就計算位元組數:
>>> len(b'ABC')
3
>>> len(b'\xe4\xb8\xad\xe6\x96\x87')
6
>>> len('中文'.encode('utf-8'))
6
可見,1個中文字元經過UTF-8編碼後通常會占用3個位元組,而1個英文字元只占用1個位元組。
在操作字元串時,我們經常遇到str
和bytes
的互相轉換。為了避免亂碼問題,應當始終堅持使用UTF-8編碼對str
和bytes
進行轉換。
由於Python源代碼也是一個文本文件,所以,當你的源代碼中包含中文的時候,在保存源代碼時,就需要務必指定保存為UTF-8編碼。當Python解釋器讀取源代碼時,為了讓它按UTF-8編碼讀取,我們通常在文件開頭寫上這兩行:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
第一行註釋是為了告訴Linux/OS X系統,這是一個Python可執行程式,Windows系統會忽略這個註釋;
第二行註釋是為了告訴Python解釋器,按照UTF-8編碼讀取源代碼,否則,你在源代碼中寫的中文輸出可能會有亂碼。
申明瞭UTF-8編碼並不意味著你的.py
文件就是UTF-8編碼的,必須並且要確保文本編輯器正在使用UTF-8 without BOM編碼:
如果.py
文件本身使用UTF-8編碼,並且也申明瞭# -*- coding: utf-8 -*-
,打開命令提示符測試就可以正常顯示中文:
第一周-第09章節-Python3.5-字元編碼的區別與介紹
#!/usr/bin/env python
"""
@author:chenjisong
@file: HelloWorld.py
@time: 2019/04/15
url:https://www.liaoxuefeng.com
functions:
Software:JetBrains PyCharm 4.5.3
"""
name = "你好,世界"
print(name)
======================================================================
G:\Python2.7.5\python.exe G:/practise/oldboy/day1/HelloWorld.py
File "G:/practise/oldboy/day1/HelloWorld.py", line 24
SyntaxError: Non-ASCII character '\xe4' in file G:/practise/oldboy/day1/HelloWorld.py on line 24, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
Process finished with exit code 1
原因:python2中因為沒有指定字元編碼集,所以報錯
#!/usr/bin/env python
#-*- coding:utf-8 _*-
name = ("你好,世界").decode(encoding="utf-8")
print(name)
========================================================================
G:\Python2.7.5\python.exe G:/practise/oldboy/day1/HelloWorld.py
你好,世界
Process finished with exit code 0
解決方法:導入utf-8字元集(#-*- coding:utf-8 _*-)並解碼 decode(encoding="utf-8")
在puthon 3中
#!/usr/bin/env python
"""
@author:chenjisong
@file: HelloWorld.py
@time: 2019/04/15
url:https://www.liaoxuefeng.com
functions:
Software:JetBrains PyCharm 4.5.3
"""
name = "你好,世界"
print(name)
========================================================================
G:\Python3.7.3\python.exe G:/practise/oldboy/day1/HelloWorld.py
你好,世界
Process finished with exit code 0
在python 3中無需指定編碼格式也無需解碼
第一周-第10章節-Python3.5-用戶交互程式
#!/usr/bin/env python
#-*- coding:utf-8 _*-
"""
@author:chenjisong
@file: interaction.py
@time: 2019/04/15
url:https://www.liaoxuefeng.com
functions:
Software:JetBrains PyCharm 4.5.3
"""
username=input("username:")
password=input("Password:")
print("Username is "+username,"and Password is "+password)
===========================================================================
G:\Python3.7.3\python.exe G:/practise/oldboy/day1/interaction.py
username:chenjisong
Password:chenjisong
Username is chenjisong and Password is chenjisong
Process finished with exit code 0
解釋:紅色部分為用戶輸入的部分。返回的結果調用了輸入的變數,形成了交互程式
字元串拼接第一種方法(占位符):
#!/usr/bin/env python
#-*- coding:utf-8 _*-
"""
@author:chenjisong
@file: interaction.py
@time: 2019/04/15
url:https://www.liaoxuefeng.com
functions:
Software:JetBrains PyCharm 4.5.3
"""
Name=input("name:")
Age=input("Age:")
Job=input("Job:")
Salary=input("Salary:")
info='''
----------------info of %s------------------
Name:%s
Age:%s
Job:%s
Salary:%s
''' % (Name,Name,Age,Job,Salary)
print(info)
=========================================================================
G:\Python3.7.3\python.exe G:/practise/oldboy/day1/interaction.py
name:chenjisong
Age:23
Job:IT
Salary:3000
----------------info of chenjisong------------------
Name:chenjisong
Age:23
Job:IT
Salary:3000
Process finished with exit code 0
註意:%s代表字元串
%d代表整數類型
%f代表浮點數
字元串拼接第二種方法(字元串轉換):
#!/usr/bin/env python
#-*- coding:utf-8 _*-
"""
@author:chenjisong
@file: interaction.py
@time: 2019/04/15
url:https://www.liaoxuefeng.com
functions:
Software:JetBrains PyCharm 4.5.3
"""
Name=input("name:")
Age=int(input("Age:"))
Job=input("Job:")
Salary=float(input("Salary:"))
info='''
----------------info of %s------------------
Name:%s
Age:%d
Job:%s
Salary:%f
''' % (Name,Name,Age,Job,Salary)
print(info)
====================================================================
G:\Python3.7.3\python.exe G:/practise/oldboy/day1/interaction.py
name:chennjisong
Age:23
Job:IT
Salary:1888
----------------info of chennjisong------------------
Name:chennjisong
Age:23
Job:IT
Salary:1888.000000
Process finished with exit code 0
解釋:紅色部分為數據類型的強制轉換,綠色部分為輸入的變數
字元串拼接第三種方法(format):
#!/usr/bin/env python
#-*- coding:utf-8 _*-
"""
@author:chenjisong
@file: interaction.py
@time: 2019/04/15
url:https://www.liaoxuefeng.com
functions:
Software:JetBrains PyCharm 4.5.3
"""
Name=input("name:")
Age=int(input("Age:"))
Job=input("Job:")
Salary=float(input("Salary:"))
info='''
----------------info of {_Name}------------------
Name:{_Name}
Age:{_Age}
Job:{_Job}
Salary:{_Salary}
''' .format(_Name=Name,_Age=Age,_Job=Job,_Salary=Salary)
print(info)
=============================================================================================
G:\Python3.7.3\python.exe G:/practise/oldboy/day1/interaction.py
name:chenjisong
Age:23
Job:IT
Salary:289
----------------info of chenjisong------------------
Name:chenjisong
Age:23
Job:IT
Salary:289.0
Process finished with exit code 0
解釋:將變數與值形成一一對應的關係
字元串拼接第四種方法(花括弧):
#!/usr/bin/env python
#-*- coding:utf-8 _*-
"""
@author:chenjisong
@file: interaction.py
@time: 2019/04/15
url:https://www.liaoxuefeng.com
functions:
Software:JetBrains PyCharm 4.5.3
"""
Name=input("name:")
Age=int(input("Age:"))
Job=input("Job:")
Salary=float(input("Salary:"))
info='''
----------------info of {0}------------------
Name:{0}
Age:{1}
Job:{2}
Salary:{3}
''' .format(Name,Age,Job,Salary)
print(info)
=============================================================================================
G:\Python3.7.3\python.exe G:/practise/oldboy/day1/interaction.py
name:chenjisong
Age:28
Job:IT
Salary:2900
----------------info of chenjisong------------------
Name:chenjisong
Age:28
Job:IT
Salary:2900.0
Process finished with exit code 0
將變數換成花括弧中的位置參數,併在format後面指明變數
第一周-第11章節-Python3.5-if else流程判斷
最簡單的邏輯判斷:
#!/usr/bin/env python
#-*- coding:utf-8 _*-
"""
@author:chenjisong
@file: getpass.py
@time: 2019/04/15
url:https://www.liaoxuefeng.com
functions:
Software:JetBrains PyCharm 4.5.3
"""
_username = "chenjisong"
_password = "chenjisong123"
username = input("Name:")
password = input("Password:")
if _username==username and _password==password:
print("Welcome user {name} login ...".format(name=username))
else:
print("Invalid username or password.")
=====================================================================================
兩種結果:
條件不符合:
"G:\Python 3.6.6\python.exe" G:/practise/oldboy/day1/getpass.py
Name:cjs
Password:123
Invalid username or password.
Process finished with exit code 0
條件符合:
"G:\Python 3.6.6\python.exe" G:/practise/oldboy/day1/getpass.py
Name:chenjisong
Password:chenjisong123
Welcome user chenjisong login ...
Process finished with exit code
邏輯判斷:當輸入的值等於變數中存儲的值的時候,列印歡迎登陸成功,反之,返回錯誤的用戶名和密碼。
多重邏輯判斷:
#!/usr/bin/env python
#-*- coding:utf-8 _*-
"""
@author:chenjisong
@file: guess.py
@time: 2019/04/16
url:https://www.liaoxuefeng.com
functions:
Software:JetBrains PyCharm 4.5.3
"""
Name_Of_Oldboy = 56
guess_age = int(input("please input your guess number:"))
if guess_age == Name_Of_Oldboy:
print("Yes,you got it.")
elif guess_age > Name_Of_Oldboy:
print("think smaller.")
else:
print("think bigger.")
=====================================================================================
三種判斷結果:
1、小於實際數值
"G:\Python 3.6.6\python.exe" G:/practise/oldboy/day1/guess.py
please input your guess number:55
think bigger.
Process finished with exit code 0
2、等於實際數值
"G:\Python 3.6.6\python.exe" G:/practise/oldboy/day1/guess.py
please input your guess number:56
Yes,you got it.
Process finished with exit code 0
3、大於實際數值
"G:\Python 3.6.6\python.exe" G:/practise/oldboy/day1/guess.py
please input your guess number:57
think smaller.
Process finished with exit code 0
第一周-第12章節-Python3.5-while 迴圈
while死迴圈,恆成立:
#!/usr/bin/env python
#-*- coding:utf-8 _*-
"""
@author:chenjisong
@file: while.py
@time: 2019/04/16
url:https://www.liaoxuefeng.com
functions:
Software:JetBrains PyCharm 4.5.3
"""
count = 0
while True:
print(count)
count = count + 1
死迴圈:當條件成立的時候,永久的執行下去的迴圈,無法跳出迴圈
當條件成立時候退出迴圈,否則一直迴圈下去:
#!/usr/bin/env python
#-*- coding:utf-8 _*-
"""
@author:chenjisong
@file: guess.py
@time: 2019/04/16
url:https://www.liaoxuefeng.com
functions:
Software:JetBrains PyCharm 4.5.3
"""
Name_Of_Oldboy = 56
while True:
guess_age = int(input("please input your guess number:"))
if guess_age == Name_Of_Oldboy:
print("Yes,you got it.")
break
elif guess_age > Name_Of_Oldboy:
print("think smaller.")
else:
print("think bigger.")
三次迴圈計數,如果三次猜不對就退出,如果猜對了立馬退出
#!/usr/bin/env python
#-*- coding:utf-8 _*-
"""
@author:chenjisong
@file: guess.py
@time: 2019/04/16
url:https://www.liaoxuefeng.com
functions:
Software:JetBrains PyCharm 4.5.3
"""
Name_Of_Oldboy = 56
count = 0
while True:
if count == 3: ####三次計數
break ####錯誤就退出
guess_age = int(input("please input your guess number:"))
if guess_age == Name_Of_Oldboy:
print("Yes,you got it.")
break
elif guess_age > Name_Of_Oldboy:
print("think smaller.")
else:
print("think bigger.")
count += 1 ####每迴圈一次,計數器加1
#!/usr/bin/env python
#-*- coding:utf-8 _*-
"""
@author:chenjisong
@file: guess.py
@time: 2019/04/16
url:https://www.liaoxuefeng.com
functions:
Software:JetBrains PyCharm 4.5.3
"""
Name_Of_Oldboy = 56
count = 0
while count < 3: #當次數大於3次的時候退出
guess_age = int(input("please input your guess number:"))
if guess_age == Name_Of_Oldboy:
print("Yes,you got it.")
break
elif guess_age > Name_Of_Oldboy:
print("think smaller.")
else:
print("think bigger.")
count += 1 #每迴圈一次,計數器加1
while...else....語法
#!/usr/bin/env python
#-*- coding:utf-8 _*-
"""
@author:chenjisong
@file: guess.py
@time: 2019/04/16
url:https://www.liaoxuefeng.com
functions:
Software:JetBrains PyCharm 4.5.3
"""
Name_Of_Oldboy = 56
count = 0
while count < 3:
guess_age = int(input("please input your guess number:"))
if guess_age == Name_Of_Oldboy:
print("Yes,you got it.")
break
elif guess_age > Name_Of_Oldboy:
print("think smaller.")
else:
print("think bigger.")
count += 1
else:
print("you have tried too many times!!!")
解釋:當嘗試的次數小於3的時候,走上面的代碼。
當嘗試的次數大於3的時候,列印 you have tried too many times
第一周-第13章節-Python3.5-while 迴圈優化版本
#!/usr/bin/env python
#-*- coding:utf-8 _*-
"""
@author:chenjisong
@file: for.py
@time: 2019/04/16
url:https://www.liaoxuefeng.com
functions:
Software:JetBrains PyCharm 4.5.3
"""
Name_Of_Oldboy = 56
count = 0
for i in range(3):
guess_age = int(input("please input your guess number:"))
if guess_age == Name_Of_Oldboy:
print("Yes,you got it.")
break
elif guess_age > Name_Of_Oldboy:
print("think smaller.")
else:
print("think bigger.")
else:
print("you have tried too many times!!!")
####任性玩:
#!/usr/bin/env python
#-*- coding:utf-8 _*-
"""
@author:chenjisong
@file: while.py
@time: 2019/04/16
url:https://www.liaoxuefeng.com
functions:
Software:JetBrains PyCharm 4.5.3
"""
Name_Of_Oldboy = 56
count = 0
#for i in range(3):
while count < 3:
guess_age = int(input("please input your guess number:"))
if guess_age == Name_Of_Oldboy:
print("Yes,you got it.")
break
elif guess_age > Name_Of_Oldboy:
print("think smaller.")
else:
print("think bigger.")
count += 1
if count == 3:
continue_confirm = input("do you want to keep guessing...?")
if continue_confirm != "N":
count = 0
解釋:當三次猜數都沒有猜對且次數大於3時發出繼續的確認信息,如果輸入N,就退出,如果輸入其他任意鍵,繼續
第一周-第14章節-Python3.5-for 迴圈及作業要求
continue:跳出本次迴圈進行下一次迴圈
break :跳出整個迴圈
#!/usr/bin/env python
#-*- coding:utf-8 _*-
"""
@author:chenjisong
@file: chengfakoujue.py
@time: 2019/04/16
url:https://www.liaoxuefeng.com
functions:乘法口訣表
Software:JetBrains PyCharm 4.5.3
"""
for i in range(1,10):
for j in range(1,i+1):
print("%d * %d = %2d" % (j,i,j*i),end=" ")
print (" ")
========================================================================
G:\Python3.7.3\python.exe G:/practise/oldboy/day1/chengfakoujue.py
1 * 1 = 1
1 * 2 = 2 2 * 2 = 4
1 * 3 = 3 2 * 3 = 6 3 * 3 = 9
1 * 4 = 4 2 * 4 = 8 3 * 4 = 12 4 * 4 = 16
1 * 5 = 5 2 * 5 = 10 3 * 5 = 15 4 * 5 = 20 5 * 5 = 25
1 * 6 = 6 2 * 6 = 12 3 * 6 = 18 4 * 6 = 24 5 * 6 = 30 6 * 6 = 36
1 * 7 = 7 2 * 7 = 14 3 * 7 = 21 4 * 7 = 28 5 * 7 = 35 6 * 7 = 42 7 * 7 = 49
1 * 8 = 8 2 * 8 = 16 3 * 8 = 24 4 * 8 = 32 5 * 8 = 40 6 * 8 = 48 7 * 8 = 56 8 * 8 = 64
1 * 9 = 9 2 * 9 = 18 3 * 9 = 27 4 * 9 = 36 5 * 9 = 45 6 * 9 = 54 7 * 9 = 63 8 * 9 = 72 9 * 9 = 81
Process finished with exit code 0
作業:一.博客
二.編寫登錄介面
1.輸入用戶名密
2.認證成功後顯示歡迎信息
3.輸錯三次後鎖定
三、多級菜單
1.三級菜單
2.可依次選擇進入各子菜單
3.所需知識點,列表,字典