Discuss / Python / 使用3种方法print,刚才代码忘记*100了

使用3种方法print,刚才代码忘记*100了

Topic source

r = (s2 - s1) / s1 * 100

a = '小明'

print('Hello, %s, 你的成绩提升了%.1f%%' % (a,r))

print('Hello, {0}, 你的成绩提升了{1:.1f}%'.format('小明',r))

print(f'Hello, {a}, 你的成绩提升了{r:.1f}%')


  • 1

Reply