In [1]:
def computer_square(end):
i = 1
total_end = 1
while i < end:
i = i + 1
total_end = total_end * i
return total_end
m = int(input('请输入第一个整数,以回车结束。'))
n = int(input('请输入第二个整数,以回车结束。'))
k = int(input('请输入第三个整数,以回车结束。'))
print('最终的和是', computer_square(m) + computer_square(n) + computer_square(k))
In [1]:
def computer_total(end):
i = 1
total_end = 1
while i < end:
total_end = total_end + -1 ** i *(1/(2*i)+1)
i = i + 1
return total_end
print('最终的和是', (computer_total(1000) + computer_total(100000))*4)
In [ ]:
def computer_total(x, y, z):
total = x
x = x + z
while x < y:
total = total + x
x = x + z
return total
m = int(input('请输入起始数字'))
n = int(input('请输入终止数字'))
k = int(input('请输入间隔大小'))
print('和为', computer_total(m, n, k))
In [4]:
def define(day):
if 1.20<=date<=2.18:
print(name, '你是非常有性格的水瓶座')
if 2.19<=date<=3.20:
print(name, '你是非常有性格的双鱼座')
if 3.21<=date<=4.19:
print(name, '你是非常有性格的白羊座')
if 4.20<=date<=5.20:
print(name, '你是非常有性格的金牛座')
if 5.21<=date<=6.21:
print(name, '你是非常有性格的双子座')
if 6.22<=date<=7.22:
print(name, '你是非常有性格的巨蟹座')
if 7.23<=date<=8.22:
print(name, '你是非常有性格的狮子座')
if 2.19<=date<=3.20:
print(name, '你是非常有性格的双鱼座')
if 3.21<=day<=4.19:
print(name,'你是非常有性格的白羊座')
if 4.20<=day<=5.20:
print(name, '你是非常有性格的金牛座')
if 5.21<=day<=6.21:
print(name, '你是非常有性格的双子座')
if 6.22<=day<=7.22:
print(name, '你是非常有性格的巨蟹座')
if 7.23<=day<=8.22:
print(name, '你是非常有性格的狮子座')
if 8.23<=day<=9.22:
print(name,'你是非常有性格的处女座')
if 9.23<=day<=10.23:
print(name,'你是非常有性格的天秤座')
if 10.24<=day<=11.22:
print(name, '你是非常有性格的天蝎座')
if 11.23<=day<=12.21:
print(name,'你是非常有性格的射手座')
if 12.22<=day or day<=1.19:
print(name,'你是非常有性格的摩羯座')
name = input('请输入您的姓名,以回车结束。')
date = float(input('请输入您的出生日期,月份和日之间以“.”隔开,以回车结束。'))
define(date)
In [5]:
def define(pm):
if pm >= 500.0:
print('请打开空气净化器,出门请戴口罩。')
else:
print('空气质量良好!')
data = float(input('请输入当前pm2.5浓度,以回车结束'))
define(data)
In [ ]:
def computer_total(x, y, z):
total = x
x = x + z
while x < y:
total = total + x
x = x + z
return total
m = int(input('请输入起始数字'))
n = int(input('请输入终止数字'))
k = int(input('请输入间隔大小'))
print('和为', computer_total(m, n, k)