單行註釋 用#
多行註釋 用三個單引號或三個雙引號'''被註釋的內容'''
msg = "I love china" #在這裏是給這一行代碼加註釋 print (msg) print (msg) #print (msg) '''print (msg) print (msg)'''
用戶的基本的輸入輸出、整數字符串的轉換、字符串的拼接
death_age = 80 name = input("please input your name:") age = input("please input your age:") #接收的是字符串,即使輸入的是數字,也被認爲是字符串 #int整數,把整數轉換爲字符串str(要轉換的內容) #str字符串,把字符串轉換爲整數int(要轉換的內容) print("your name",name) print("you can still live",death_age-int(age),"years") #轉換之後相減 print("you can still live"+str(death_age-int(age))+"years") #轉換之後字符串拼接