1、编写程序,输出1~1000之间所有既可以被3整除,又可以被5整除的数;
i = 1
for i in range(1,1000):
if (i%3==0)&(i%5==0):
print(i)
2、编写程序,定义一个函数,能够从键盘输入n个数,并输出这些数的平均值、最小数与最大数;
print("-----求平均值,可输入任意多个数-------")
lst = [] #定义一个空列表
str = input("请输入数值,用逗号隔开,")
lst1 = str.split(",")#lst1用来存储输入的字符串,用空格分割
i = 0
length = int(len(lst1))
while i <= length-1:
lst.append(int(lst1.pop()))#将lst1的数据转换为整型并赋值给lst
i += 1
def operation(list):
i = 0
j = 0
s = 0
avg = 0
#print("list:",list)
max = list[0]
min = list[0]
for i in range(0,len(list)):
if max <= list[i]:
max = list[i]
i += 1
else:
i += 1
for j in range(0,len(list)