# coding=utf-8
L = [95.5, 85, 59, 66, 72]
# 从小到大排序
Score_L = sorted(L)
# 颠倒排序
Score_L.reverse()
# 打印前三名
print(Score_L[0:3])
L = [95.5, 85, 59, 66, 72]
# 从小到大排序
Score_L = sorted(L)
# 颠倒排序
Score_L.reverse()
# 打印前三名
print(Score_L[0:3])
2023-05-08
最新回答 / 刻命
<...图片...>代码没有问题, 可以这样理解s = 'you age={}'s.format(age)意思是将字符串s进行格式化输出, 将变量age的值插入到花括号占位符
2023-05-05
# Enter a code
L = ['Alice', 'Bob', 'Candy', 'David', 'Ellena']
L.pop(2)
L.pop(2)
print(L)
L = ['Alice', 'Bob', 'Candy', 'David', 'Ellena']
L.pop(2)
L.pop(2)
print(L)
2023-05-02
# Enter a code
names=['Alice', 'Bob', 'Candy', 'David', 'Ellena']
names.append('Phoebe')
names.append('Zero')
names.insert(5,'Gen')
print(names)
names=['Alice', 'Bob', 'Candy', 'David', 'Ellena']
names.append('Phoebe')
names.append('Zero')
names.insert(5,'Gen')
print(names)
2023-05-02
# Enter a code
L = [95.5, 85, 59, 66, 72]
L.sort()
print(L[-1],L[-2],L[-3])
L = [95.5, 85, 59, 66, 72]
L.sort()
print(L[-1],L[-2],L[-3])
2023-05-02
# Enter a code
L = [95.5, 85, 59, 66, 72]
num1=max(L)
L.remove(num1)
num2=max(L)
L.remove(num2)
num3=max(L)
print(num1,num2,num3)
L = [95.5, 85, 59, 66, 72]
num1=max(L)
L.remove(num1)
num2=max(L)
L.remove(num2)
num3=max(L)
print(num1,num2,num3)
2023-05-02
如果一个字符串包含很多需要转义的字符,对每一个字符都进行转义会很麻烦。为了避免这种情况,我们可以在字符串前面加个前缀r,表示这是一个 raw 字符串,里面的字符就不需要转义了。
2023-04-27
# 需要注意的是,not计算的优先级是高于and和or的
# 所以Python解释器在做布尔运算时,只要能提前确定计算结果,它就不会往后算了,直接返回结果。
所以答案是 hello python ; hello world
# 所以Python解释器在做布尔运算时,只要能提前确定计算结果,它就不会往后算了,直接返回结果。
所以答案是 hello python ; hello world
2023-04-27