作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试格式化索引和列表的输出:
[6]
[7]
[8]
[9]
The answers should be:
['b', 'c', 'a', 'c']`
更像这样:
[6] b
[7] c
[8] a
[9] c
这是代码片段:
print( "Here are the questions the you got wrong: ")
for i in range (0, 10):
if q[i] != answers[i]:
print ( [i+1],)
else:
("You got all of the questions correct, Good Job. ")
print("The answers should be: ")
print(wrongList)
最佳答案
你没有收集到 wrongList
但它很容易做到:
print("The answers should be: ")
for i in range (0, 10):
if q[i] != answers[i]:
print (q[i], answers[i])
关于python - 如何在 python 中格式化列表输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29722663/
我是一名优秀的程序员,十分优秀!