In [2]:
name=input('请输入你的名字,以回车结束。')
d=float(input('请输入你的出生日期,以回车结束。'))
if d>=3.21 and d<=4.19:
print(name,'你是白羊座')
elif d>=4.20 and d<=5.20:
print(name,'你是金牛座')
elif d>=5.21 and d<=6.21:
print(name,'你是双子座')
elif d>=6.22 and d<=7.22:
print(name,'你是巨蟹座')
elif d>=7.23 and d<=8.22:
print(name,'你是狮子座')
elif d>=8.23 and d<=9.22:
print(name,'你是处女座')
elif d>=9.23 and d<=10.23:
print(name,'你是白天秤座')
elif d>=10.24 and d<=11.22:
print(name,'你是天蝎座')
elif d>=11.23 and d<=12.21:
print(name,'你是射手座')
elif d>=12.22 and d<=1.19:
print(name,'你是摩羯座')
elif d>=1.20 and d<=2.18:
print(name,'你是水瓶座')
elif d>=2.19 and d<=3.20:
print(name,'你是双鱼座')
In [3]:
m= int (input('输入一个整数m'))
n= int (input('输入一个整数n大于m'))
print('求和输入1,乘积输入2,求余数输入3,否则计算m整除n,以回车结束。')
x= int (input())
if x==1:
i = m
total1 = 0
while i < (n + 1):
total1 += i
i += 1
print(total1)
elif x==2:
i = m
total2 = 1
while i < (n + 1):
total2 *= i
i += 1
print(total2)
elif x==3:
y = n%m
print(y)
else:
z=n//m
print(z)
In [19]:
PM2_5 = int(input('请输入PM2_5的数值,以回车结束。'))
if PM2_5>500:
print('应打开空气净化器,戴防雾霾口罩。')
elif PM2_5>250:
print('应戴口罩。')
else:
print('多喝水。')
In [16]:
print('\n')
In [4]:
m=str(input('请输入英文单词,以回车结束'))
if m.endswith('s') or m.endswith('x') or m.endswith('ch'):
print('复数为',m,'es')
elif m.endswith('y'):
print('复数把y变为i再加es')
else:
print('复数为',m,'s')
In [6]:
max_num= int(input('plz input a number'))
smax_num= int(input('plz input a number'))
if smax_num>=max_num:
smax_num,max_num = max_num,smax_num
number = None
while number !=0:
number=int(input('plz input a number'))
if number>=max_num:
smax_num=max_num
max_num=number
elif number>smax_num:
smax_num=number
else:
pass
print('The second max number is:',smax_num)