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

学生基本信息输入输出

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

from decimal import Decimal,ROUND_HALF_UP
user_input = input()
str1,str2= user_input.split(';') # ["17140216","80.845,90.55,100.00"]
str3 = str2.split(',')
score_list = []
for substr in str3:
    score = Decimal(substr).quantize(Decimal('0.00'),rounding=ROUND_HALF_UP)
    score_list.append(score)
print(f"The each subject score of No. {str1} is {score_list[0]}, {score_list[1]}, {score_list[2]}.")

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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