方法一:
g1 = 72
g2 = 85
r = (g2-g1)/g1
p = r*100
print('The grade of Xiao Ming has increased by: %.1f %%' % p)
方法二:
print('The grade of Xiao Ming has increased by: {0:.1f}%.'.format(p))
方法三:
print(f'The grade of Xiao Ming has increased by: {p:.1f}%')
Sign in to make a reply
上亿只袋鼠
方法一:
g1 = 72
g2 = 85
r = (g2-g1)/g1
p = r*100
print('The grade of Xiao Ming has increased by: %.1f %%' % p)
方法二:
g1 = 72
g2 = 85
r = (g2-g1)/g1
p = r*100
print('The grade of Xiao Ming has increased by: {0:.1f}%.'.format(p))
方法三:
g1 = 72
g2 = 85
r = (g2-g1)/g1
p = r*100
print(f'The grade of Xiao Ming has increased by: {p:.1f}%')