小编wAo*_*wAo的帖子

Python中的return()和print()有什么区别?

在python中,return()和print()会对以下代码产生不同的影响.有什么不同?为什么?

def count_wins(teamname):
    wins = 0
    for team in nfl:
        if team[2] == teamname:
            wins +=1
    return wins

def count_wins(teamname):
    wins = 0
    for team in nfl:
        if team[2] == teamname:
            wins +=1
    print wins
Run Code Online (Sandbox Code Playgroud)

nfl = [[''2009','1','Pittsburgh Steelers','Tennessee Titans'],['2009','1','Minnesota Vikings','Cleveland Browns']]

python

-6
推荐指数
1
解决办法
310
查看次数

标签 统计

python ×1