- 讓你的腳本再打印出一行。
- 讓你的腳本只打印一行。
- 在任一行的開頭放一個
#
,看看會發生什麼?試着弄明白這個符號的作用。
1.
print("Hello World!")
print("Hello Again")
print("I like typing this.")
print("This is fun.")
print("Yay! Printing.")
print("I'd much rather you 'not'")
print('I "said" do not touch this.\n')
結果:
print("\n")是打印兩行;print("hello world\n")是多打印一行 或者 print ("") 也是多打印一行
2.
print("Hello World!",end="")
print("Hello Again",end="")
print("I like typing this.",end="")
print("This is fun.",end="")
print("Yay! Printing.",end="")
print("I'd much rather you 'not'",end="")
print('I "said" do not touch this.\n',end="")
結果:
3. # 爲註釋