题解 | #学生基本信息输入输出#
学生基本信息输入输出
https://www.nowcoder.com/practice/58b6a69b4bf943b49d2cd3c15770b9fd
#from decimal import Decimal #from fractions import Fraction info = input() no, s = info.split(";") s1,s2,s3 = map(lambda x:round(float(x)+1e-10,2), s.split(",")) #s1,s2,s3 = map(lambda x:float(round(Fraction(x),2)), s.split(",")) #s1,s2,s3 = map(lambda x:round(Decimal(x),2), s.split(",")) #s1,s2,s3 = map(lambda x:round(float(x),2), s.split(",")) print(f"The each subject score of No. {no} is {s1:.2f}, {s2:.2f}, {s3:.2f}.") #print(f"The each subject score of No. {no} is {round(s1,2)}, {round(s2,2)}, {round(s3,2)}.") #print(f"The each subject score of No. {no} is {s1}, {s2}, {s3}.")
这里面水很深,我把握不住