print("Hello World!") print("hello" * 3) # 輸出3個hello print("Hello", "World!") # 中間一個空格分隔 print("多行語句 \ 分割") print("換行 \n 符") # 換行符 print("第一列\t第二列") print("不換", end="") print("行") print("a={},b={}".format(1, 2)) # a=1, b=2 print("a=%s,b=%s" % (1, 2)) input = int(input("請輸入喜歡的數字:")) print("輸出:", input)
運行結果:
Hello World! hellohellohello Hello World! 多行語句 分割 換行 符 第一列 第二列 不換行 a=1,b=2 a=1,b=2 請輸入喜歡的數字:3 輸出: 3