d = {
'Alice': 45,
'Bob': 60,
'Candy': 75,
'David': 86,
'Ellena': 49
}
print('Alice old score is {}'.format(d['Alice']))
d['Alice']=60
print(d)
'Alice': 45,
'Bob': 60,
'Candy': 75,
'David': 86,
'Ellena': 49
}
print('Alice old score is {}'.format(d['Alice']))
d['Alice']=60
print(d)
2024-04-16
sum = 0
num = 0
while num <= 1000:
if num % 2 != 0:
num += 1
continue
sum += num
num += 2
print(sum)
num = 0
while num <= 1000:
if num % 2 != 0:
num += 1
continue
sum += num
num += 2
print(sum)
2024-04-07
sum = 0
num = 0
while True:
sum += num
num += 2
if num > 1000:
break
print(sum)
num = 0
while True:
sum += num
num += 2
if num > 1000:
break
print(sum)
2024-04-07
L = [75, 92, 59, 68, 99]
tl = 0
for sc in L:
tl += sc
averge = tl / len(L)
print('平均成绩是:',averge)
tl = 0
for sc in L:
tl += sc
averge = tl / len(L)
print('平均成绩是:',averge)
2024-04-07
name=['Alice', 'Bob', 'Candy', 'David', 'Ellena']
name[0]='Ellena'
name[1]='Alice'
name[4]='Bob'
print(name)
name[0]='Ellena'
name[1]='Alice'
name[4]='Bob'
print(name)
2024-04-07
这样也可以:
L = ['Alice', 66, 'Bob', True, 'False', 100]
num=0
for ch in L:
num=num+1
if num%2==0:
print(ch)
L = ['Alice', 66, 'Bob', True, 'False', 100]
num=0
for ch in L:
num=num+1
if num%2==0:
print(ch)
2024-04-07
最新回答 / weixin_慕无忌2449547
# coding: utf-8age = 18sing = 'adult {}'if age >= 18: print(sing.format(age)+'岁') if age < 18: print('未成年')
2024-04-01
最新回答 / 玉侬_T
a="\\\",因为第一个\转义了第二个\,而第三个\转义了最后一个引号,引起语法错误。你可以尝试在字符串的结尾再加一个收引号,a="\\\"",打印的结果将是\"
2024-04-01