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

学生基本信息输入输出

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区分

全部评论

相关推荐

评论
2
1
分享

创作者周榜

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