我对编程世界相当陌生,我很想知道为什么下面的代码不仅拒绝运行,而且我的python软件甚至不会给我任何错误消息。我无法让应用程序运行此代码(它不会给我任何错误消息),我想知道这是我的代码本身,还是只是应用程序。如能了解这一问题,我们将不胜感激。在
def starBits():
badMatchups = [Zelda, Cloud, Ryu]
worstMatchups = [Jigglypuff, Villager, Bayonetta]
print(badMatchups)[1:2]
print(worstMatchups)[1:1]
def main():
starBits()
main()
我不知道你对此有什么期望,但它的语法真的很时髦。在
如果这些片段是列表的下标,则需要在调用print时使用它们:
^{pr2}$顺便问一下,你知不知道[1:1]是一片空白?第二个数字是第一个包含的位置。你可能需要
另外,这些元素是外部变量,还是应该是字面名称?如果是后者,那你就得把它们用引号引起来。在
有了这个变化,代码就可以运行了;我希望这是您想要的。在
不能让它运行吗?现实检查时间。。。在
完整代码,所做的更改:
输出:
相关问题 更多 >
编程相关推荐