Python-Learn/PythonBasic/LessonCode/theString.py
2022-03-20 16:16:39 +08:00

8 lines
294 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#小明的成绩从去年的72分提升到了今年的85分请计算小明成绩提升的百分点并用字符串格式化显示出'xx.x%'只保留小数点后1位
# -*- coding: utf-8 -*-
s1 = 72
s2 = 85
r = ((s2/s1)-1.0)*100
print('小明的成绩今年提升了:%.01f %%' % r)