Discuss / Python / zy

微辣二毛

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

r = (s2-s1)/s1*100

print('%s成绩提高了: %.2f%%' %("小明", r))

print('{0}成绩提高了: {1:.2f}%'.format("小明", r))

print(f'小明成绩提高了: {r:.2f}%')

微辣二毛

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

r = (s2-s1)/s1*100

print('去年成绩:%d,今年成绩:%d,%s成绩提高了: %.2f%%' %(s1, s2, "小明", r))

print('去年成绩:{0},今年成绩:{1},{2}成绩提高了: {3:.2f}%'.format(s1, s2, '小明', r))

print(f'去年成绩:{s1},今年成绩:{s2},小明成绩提高了: {r:.2f}%')

不是很明白这个下面的符号应用,不知道能不能教一下我呀-_-|||微信号nicai111925


  • 1

Reply