在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 ×1