一:請輸入名片 (姓名,年齡,職業,愛好)設計名片學習
name=input('你的名字') age=input('你的年齡') job=input('你的工做') hobbie=input('你的愛好') msg=''' inof of %s name:%s age:%s job:%s hobbie:%s end ''' %(name,name,age,job,hobbie) print(msg) 二:%的使用
name=input('你的名字') age=input('你的年齡') height=input('你的身高') msg='''我叫%s,個人年齡是%d,學習進度是%%3,個人身高是%s, ''' %(name,int(age),height) print(msg) # 個人年齡是若是輸入%s %(name,age,height)
# 個人年齡是若是輸入%d %(name,int(age),height)