s1 = 'ABC'
s2 = '123'
s3 = 'xyz'
n = 0 #設置循環(huán)次數(shù)初始值
for x in s1:
for y in s2:
for z in s3:
print(x+y+z)
n =n + 1
print(n) #打印出最終循環(huán)的次數(shù)
s2 = '123'
s3 = 'xyz'
n = 0 #設置循環(huán)次數(shù)初始值
for x in s1:
for y in s2:
for z in s3:
print(x+y+z)
n =n + 1
print(n) #打印出最終循環(huán)的次數(shù)
2025-03-12
# Enter a code
num = 0
sum = 0
while True:
if num > 1000:
break
if num <= 1000:
sum = sum + num
num = num + 2
print(sum)
num = 0
sum = 0
while True:
if num > 1000:
break
if num <= 1000:
sum = sum + num
num = num + 2
print(sum)
2025-03-12
num = 0
sum = 0
while True:
if num > 1000:
break
sum = sum + num
num = num + 2
print(sum)
sum = 0
while True:
if num > 1000:
break
sum = sum + num
num = num + 2
print(sum)
2025-03-11
num = 1
result = 1
while num <= 10:
result = result * num
num = num + 1
print(result)
result = 1
while num <= 10:
result = result * num
num = num + 1
print(result)
2025-03-11
L = [75, 92, 59, 68, 99]
sum = 0.0
ab = len(L)
for i in L:
sum = sum + i
print(sum/ab)
sum = 0.0
ab = len(L)
for i in L:
sum = sum + i
print(sum/ab)
2025-03-10
age = 4
if age >= 18:
print("adult")
elif age >= 6:
print("teenager")
elif age >=3:
print("kid")
else:
print("baby")
if age >= 18:
print("adult")
elif age >= 6:
print("teenager")
elif age >=3:
print("kid")
else:
print("baby")
2025-03-10
result = 0
num = 0
while True:
if num <= 1000:
result += num
num += 2
else:
break
print(result)
num = 0
while True:
if num <= 1000:
result += num
num += 2
else:
break
print(result)
2025-03-03
d = {'Alice': [50, 61, 66], 'Bob': [80, 61, 66], 'Candy': [88, 75, 90]}
for k,v in d.items():
for v in d[k]:
print(k,v)
for k,v in d.items():
for v in d[k]:
print(k,v)
2025-03-03
print('方式1')
tp = 'Life is {},you need {}'
print (tp.format('short','python'))
print('方式2')
tp1= 'Life is {0},you need {1}'
result1=tp1.format('short','python')
print(result1)
tp = 'Life is {},you need {}'
print (tp.format('short','python'))
print('方式2')
tp1= 'Life is {0},you need {1}'
result1=tp1.format('short','python')
print(result1)
2025-02-28