This commit is contained in:
SXHome
2022-03-20 16:16:39 +08:00
parent b2990131d8
commit e0fa4ad208
2 changed files with 0 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
print('Lesson ','1','"start"...\n')
print("-------Demo 1-------\n")
str = input('Please input your name:\n')
print('Your input name is:',str)
print("-------Demo 2-------\n")
# Store input numbers
num1 = input('Enter first number: ')
num2 = input('Enter second number: ')
# Add two numbers
sum = float(num1) + float(num2)
# Display the sum
print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))
print("-------Demo 3-------\n")
print('The sum is %.1f' %(float(input('Enter first number: ')) + float(input('Enter second number: '))))
+8
View File
@@ -0,0 +1,8 @@
#小明的成绩从去年的72分提升到了今年的85分,请计算小明成绩提升的百分点,并用字符串格式化显示出'xx.x%',只保留小数点后1位:
# -*- coding: utf-8 -*-
s1 = 72
s2 = 85
r = ((s2/s1)-1.0)*100
print('小明的成绩今年提升了:%.01f %%' % r)