一、利用程序流程控制语句打印运行效果如图所示的九九乘法表,要求:关键语句要有注释
实现代码
#九九乘法表
for i in range(1,10):
j=1
while j<=i:
print("{0}*{1}={2:<4}".format(i,j,i*j),end='')
j+=1
print()
# 交纳党费
salary = float(input('请输入有固定工资收入的党员的月工资:'))
fei = 0
if salary > 1500:
fei = 0.03*salary
print('月工资={0} , 交纳党费={1}'.format(salary,fei))
elif salary >=801:
fei = 0.02*salary
print('月工资={0} , 交纳党费={1}'.format(salary,fei))
elif salary >=601:
fei = 0.015*salary
print('月工资={0} , 交纳党费={1}'.format(salary,fei))
elif salary >=401:
fei = 0.01*salary
print('月工资={0} , 交纳党费={1}'.format(salary,fei))
elif salary <=400 and salary >=0:
fei = 0.005*salary
print('月工资={0} , 交纳党费={1}'.format(salary,fei))
else:
print('输入有误,请重新输入')