Discuss / Python / 作业

作业

Topic source

咪咪

#1 Created at ... [Delete] [Delete and Lock User]

name = str(input('请确认您的名字'))

S1 = int(input('请确认上次成绩!'))

S2 = int(input('请确认本次成绩!'))

R = (S2 - S1)/S2*100

R1 = -(S1 - S2)/S2*100

if S2 > S1:

    print(name+'您本次成绩提升了%.1f%%'%R)#方式1

    print(name+f'您本次成绩提升了{R:.2f}%'.format(R))#方式2

    print(name+'您本次成绩提升了%s%%'%(R))

elif S1 > S2:

    print(name+'您本次成绩下滑了%.1f%%'%R1)#方式1

    print(name+'您本次成绩下滑了{R1:.2f}%'.format(R1))#方式2

    print(name+'您本次成绩下滑了%s%%'%(R1))

else:

    print(name+'再接再砺')


  • 1

Reply