题解 | #学生基本信息输入输出#

学生基本信息输入输出

https://www.nowcoder.com/practice/58b6a69b4bf943b49d2cd3c15770b9fd

num = input().split(";")
#首先分割数据,并分别储存
id = num[0]
score = num[1]
num_1 = score.split(",")
#使用split方法将后续数据封存在一个数组中
#float可以把字符串转换为浮点数,从而实现保留两位小数
score1 = format(float(num_1[0]) + 0.00001, ".2f")
score2 = format(float(num_1[1]) + 0.00001, ".2f")
score3 = format(float(num_1[2]) + 0.00001, ".2f")
print(f"The each subject score of No. {id} is {score1}, {score2}, {score3}.")

全部评论

相关推荐

06-04 09:27
门头沟学院 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务