homework03
程序员文章站
2022-06-10 16:12:54
...
x = 1
zs = 0
fs = 0
i = 0
sum_ = 0
while x != 0:
x = int(input('输入一个整数,以输入0结束'))
if(x>0):
zs += 1
elif(x<0):
fs += 1
i += 1
sum_ = sum_ + x
if sum_ != 0:
xx = sum_/(i-1)
print(zs,fs,sum_,xx)
else:
print("结束")
a = 10000
for i in range(14):
a = a*0.05+a
if i == 11:
print(a)
count=0
for i in range(100,1001):
if i%5 == 0 and i%6 == 0:
count += 1
print(i,end=" ")
if count % 10 == 0:
print("\n")
n = 1
while n*n <= 12000:
n += 1
print(n)
n1 = 1
while n1**3 <= 12000:
n1 += 1
print(n1)
n = 0
for i in range(1,5000,-1):
n= n + 1/i
print(n)
n = 0
for i in range(1,5000,1):
n= n + 1/i
print(n)
sum = 0
for i in range(3,100,2):
sum += (i-2)/i
print(sum)
x = 0
for i in range(1,10000):
x += 4*((-1)**(i+1)/(2*i-1))
print(x)
for i in range(1,10001):
s= 0
for j in range(1,i):
if i%j == 0:
s = s+j
if i == s:
print(i)
a = [ ]
for i in range(1,8):
for j in range(1,8):
if i != j and sorted([i,j]) not in a:
a.append([i,j])
print(a)
print(len(a))
import numpy as np
arr = []
i = 1
while i <= 10:
x = float(input('请输入十个数'))
arr.append(x)
i += 1
arr_mean = np.mean(arr)
arr_var = np.var(arr)
print(arr_mean)
print(arr_var)
上一篇: koltin协程图片加载库Coil介绍
下一篇: URL和URI的区别
推荐阅读