e027: P37 print() d,f,c,s
Tags : Python
Accepted rate : 0人/0人 (0%) [非即時]
評分方式:
Tolerant

最近更新 : 2024-12-26 13:38

Content

使用「%」控制資料輸出時,還要依資料的型態使用對應的符號,整數請用「d」,浮點數使用「f」,字元用「c」,字串請用「s」

swa=3.4
print("%f" % a)
print("%d" % a)

a = 65
print("%d" % a)
print("%c" % a)

a = "Horng"
b = 56
print("帥哥%s 年齡是%d" % (a, b))

Input
Output
Sample Input #1


											
										
Sample Output #1
3.400000
3
65
A
師哥Horng 年齡是56
測資資訊:
記憶體限制: 64 MB
公開 測資點#0 (100%): 1.0s , <1K
Hint :
Tags:
Python
出處:
[管理者: zero(育達管理員) ]


ID User Problem Subject Hit Post Date
沒有發現任何「解題報告」