首页 > 编程语言 >python-练习(字符串str与列表list)

python-练习(字符串str与列表list)

时间:2022-12-05 19:00:09浏览次数:35  
标签:%. python s1 list 60 67802 cure str 字符串

打印字符串

"""
    根据下列文字,提取变量,使用字符串格式化打印信息
    湖北确诊67802人,治愈63326人,治愈率0.99   
"""

region = "湖南"
confirmed = 67802
cure = 63326
proportion = 0.99

print("%s确诊%s人,治愈%s人,治愈率%.2f%%" % (region, confirmed, cure, proportion * 100))

秒转分

"""
    70秒是01分零10秒
"""
s1 = 70
m = s1 // 60
s2 = s1 % 60

print("%s秒时%.2d分零%.2d秒" % (s1, m, s2))

 字符串切片

 

标签:%.,python,s1,list,60,67802,cure,str,字符串
From: https://www.cnblogs.com/xmgcool/p/16953182.html

相关文章