小编Ner*_*ual的帖子

python 函数没有正确返回它们的值?

我正在尝试学习 python,并且刚刚了解了条件语句,并且正在努力创建自己的函数。

您介意告诉我我做错了什么吗?我必须在最后编写复杂的打印语句来一一调用我的所有函数?

此外,任何风格提示也将不胜感激。

预先感谢您可以提供的任何信息。

import random

#VARIABLES
topChamps = ['Nasus', 'Garen', 'Nautilus']
botChamps = ['Draven', 'Caitlyn', 'Jhin']
midChamps = ['Lux', 'Veigar', 'Karthus']
supChamps = ['Sona', 'Tahm Kench', 'Alistar']
jgChamps = ['Amumu', 'Rammus', 'Malphite']
selectNum = 0
roleNum = 0
champArr = []
champ = "wrong"
role = str(input("what role did you get? "))

#function to make the role choice easier for computer to read
def roleChoose():
    if role == "top":
        roleNum = 1
    elif role == "bot":
        roleNum = …
Run Code Online (Sandbox Code Playgroud)

python function conditional-statements

0
推荐指数
1
解决办法
132
查看次数

标签 统计

conditional-statements ×1

function ×1

python ×1