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

学生基本信息输入输出

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

all_data = input().split(';') b = all_data[1].split(',') scores = list(map(lambda x: round(eval(x) + 0.0001, 2), all_data[1].split(',')))
print('The each subject score of No. {} is {:.2f}, {:.2f}, {:.2f}.'.format(all_data[0], scores[0], scores[1], scores[2]))

round奇进偶舍

即在小数点后位数正好为5时,如后面无其他数,奇数进位,偶数收取,故加上0.0001区分

全部评论

相关推荐

点赞 评论 收藏
分享
04-03 09:32
已编辑
华南农业大学 golang
我的代码出BUG了:"晚点发个邮件调整一下时间",你收到新的邮件没,如果没有收到新的邮件,那就需要进入面试链接留痕,否则系统会判定你迟到
点赞 评论 收藏
分享
评论
2
1
分享

创作者周榜

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