Skip to content
Merged
2 changes: 1 addition & 1 deletion exercises/1901100251/1001S02E02_hello_python.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
print('hello world')
print ("hello world!")
27 changes: 27 additions & 0 deletions exercises/1901100251/1001S02E03_calculator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
print('===================自制计算器====================')
a = float(input('请输入第一个数字:'))
b = input('请输入运算符(+,-,*,/):')
c = float(input('请输入第二个数字:'))
add = a + c
#减法
sub = a - c
#乘法
times = a * c
#除法
division = a / c

print('====================输出结果=====================')
if b == '+':
print('您输入的加法运算结果为: %f'%add)

elif b == '-':
print('您输入的减法运算结果为: %f'%sub)

elif b == '*':
print('您输入的乘法运算结果为: %f'%times)

elif b == '/':
print('您输入的除法运算结果为: %f'%division)
else :
print('您输入的运算符有误!')
print('================================================')
23 changes: 23 additions & 0 deletions exercises/1901100251/1001S02E04_control_flow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#使⽤for...in循环打印九九乘法表
for a in range (1,10):
for b in range (1,10):
print (a,"x",b, "=",a*b,"\t", end= "")
if a == b:
print ("")
break






#使用while循环打印九九乘法表并⽤条件判断把偶数行去除掉
for a in range (1,10):
for b in range (1,10):
while a % 2 == 0:
break
else:
print(a,"x",b,"=",a*b,"\t", end="")
if a == b:
print ("")
break