【學習筆記】python的代碼塊(吐槽)


曾經我以為python是像pascal那樣begin開始end結束,

直到今天……

我才知道python是用縮進作為代碼段標識的……

 1 >>> def test(n):
 2 ...     if n==1:
 3 ...             print("one")
 4 ...             print("two")
 5 ...     elif n==2:
 6 ...             print("three")
 7 ...     else:
 8 ...             print("four")
 9 ... 
10 >>> n=1
11 >>> test(1)
12 one
13 two
14 >>> n=2
15 >>> test(2)
16 three
17 >>> n=5
18 >>> test(5)
19 four


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM