num = 1
sum = 1
while num <= 10:
sum *= num
num += 1
print(sum)
sum = 1
while num <= 10:
sum *= num
num += 1
print(sum)
2022-12-08
L = [75, 92, 59, 68, 99]
sum = 0;
for num in L:
sum += num;
print(sum/(len(L)))
sum = 0;
for num in L:
sum += num;
print(sum/(len(L)))
2022-12-07
最新回答 / wuzhou
改成 if not s1.isdisjoint(s2):set提供isdisjoint()方法,可以快速判断两个集合是否有重合,如果有重合,返回False,否则返回True
2022-12-06
age = 4
if age >= 18 :
print('adult')
elif age >= 6 :
print('tennager')
elif age >= 3 :
print('kid')
else :
print('baby')
if age >= 18 :
print('adult')
elif age >= 6 :
print('tennager')
elif age >= 3 :
print('kid')
else :
print('baby')
2022-11-25
template = 'Life is {x},you need {y}'
x='short'
y='Python'
result=template.format(x = x,y = y)
print(result)
template = 'Life is {1},you need {0}'
result1 = template.format('Python','short')
print(result1)
x='short'
y='Python'
result=template.format(x = x,y = y)
print(result)
template = 'Life is {1},you need {0}'
result1 = template.format('Python','short')
print(result1)
2022-11-25
print(r''' "To be, or not to be": that is the question.
Whether it's nobler in the mind to suffer.''')
Whether it's nobler in the mind to suffer.''')
2022-11-24
s = 0
a = 0
while True:
if s >= 1000:
break
s = s + 2
a = a + s
print(a)
更简单
a = 0
while True:
if s >= 1000:
break
s = s + 2
a = a + s
print(a)
更简单
2022-11-24