#第一题
age=int(input('输入年龄;'))
if age<18:
print('不接受未成年')
elif age<25:
print('心动表白')
elif age<=45:
print('阿姨好')
else:
print('奶奶好')
#第二题
count=1
h=0
while count<=100:
h += count
count +=2
print(h)
#第三题
age=18
n=1
Y='Yy'
while n<=3:
sage = int(input('输入年龄;'))
n+=1
if sage==age:
print('猜对了')
break
elif sage>age and n<=3:
print('猜大了,再试一次吧')
elif sage<age and n<=3:
print('猜小了,再试一次吧')
elif n>3:
print('连续输入超过三次了,还想猜请输入Y或y')
y=input()
if y in Y:
n=0
else:
print('游戏失败')
#练习第一题
profit = float(input('输入利润(万):'))
if profit <= 10:
print('发放奖金', profit * 0.1, '万')
elif profit <= 20:
z1 = profit - 10
print('发放奖金', 10*0.1 + z1 * 0.075, '万')
elif profit <= 40:
z1 = profit - 20
print('发放奖金', 10*0.1+10*0.075 + z1 * 0.05, '万')
else:
z1 = profit - 40
print('发放奖金', 10*0.1+10*0.075+20*0.05 + z1 * 0.03, '万')
#练习第二题
weight=float(input('请输入物品重量:'))
if weight<=1:
print('收费6元')
else:
z=weight-1
print('收费',6+z*3,'元')
#练习第三题
wage=float(input('请输入你的工资'))
if wage<=36000:
print('应缴纳个人所得税为:',(wage-5000-2000)*0.03)
elif wage<=144000:
print('应缴纳个人所得税为:',(36000-5000-2000)*0.03+(wage-36000)*0.1)
elif wage<=300000:
print('应缴纳个人所得税为:',(36000-5000-2000)*0.03+(144000-36000)*0.1+(wage-144000)*0.2)
elif wage<=420000:
print('应缴纳个人所得税为:',(36000-5000-2000)*0.03+(144000-36000)*0.1+(300000-144000)*0.2+(wage-300000)*0.25)
elif wage<=660000:
print('应缴纳个人所得税为:',(36000-5000-2000)*0.03+(144000-36000)*0.1+(300000-144000)*0.2+(420000-300000)*0.25+(wage-420000)*0.3)
elif wage<=960000:
print('应缴纳个人所得税为:',(36000-5000-2000)*0.03+(144000-36000)*0.1+(300000-144000)*0.2+(420000-300000)*0.25+(660000-420000)*0.3+(wage-660000)*0.35)
else:
print('应缴纳个人所得税为:',
(36000 - 5000 - 2000) * 0.03 + (144000 - 36000) * 0.1 + (300000 - 144000) * 0.2 + (420000 - 300000) * 0.25 + (
660000 - 420000) * 0.3 + (960000 - 660000) * 0.35+(wage-960000)*0.45)
#练习第四题
l=100
z=100
for i in range(1,10):
l = l/2
z+=l
if i==9:
print('第十次掉落高度为',l,'米')
print('第十次落地共经过距离',z,'米')
#while 循环法
height=100
c=10
i=1
j=0
while i<=c:
if i==1:
j+=height
i+=1
elif i==c:
height = height / 2
j += height
i += 1
else:
height=height/2
j+=height*2
i+=1
else:
print(height)
print(j)
#练习第五题
i=1
j=2
h=0
while j<=11:
h+=i/j
i+=i
j+=1
# print('i=',i)
# print('j=',j)
print(h)
#练习第六题
i=1
j=1
while j<10:
i+=i
j+=1
print(i)