Python调用主函数

时间:2015-09-13 19:34:55

标签: python

我是Python新手,我现在正在踢自己。我设法创建了作业所需的代码,但后来意识到我没有在“主要功能”中编写它,而对于我的生活,我似乎无法修复它。这是我需要提交的最后一步,有人可以帮忙吗?

rays_starters = {'DeJesus': ['DH', 6, 299], #First dictionary with original starters
                'Loney': ['1B', 4, 222],
                'Rivera': ['C', 9, 194],
                'Forsythe': ['2B', 5, 304],
                'Souza Jr': ['RF', 2, 229],
                'Longoria': ['3B', 3, 282],
                'Cabrera': ['SS', 7, 214],
                'Kiermaier': ['CF', 1, 240],
                'Guyer': ['LF', 8, 274]}

print ('\n' + 'Ray\'s Starters' + '\n') #Prints the list of the players 
for player in rays_starters:
    print (player + str(rays_starters[player]))

print ('\n' + 'Today\'s lineup' + '\n') #Prints the current lineup in batting order 
for key, value in sorted(rays_starters.items(), key=lambda v: v[1][1]):
    print("Batting {}: {} {}, current avg: {}".format(value[1], value[0], key, value[2]))

rays_replacements = {'Beckham': ['DH', 6, 299], #New dictionary with replacements
                    'Loney': ['1B', 4, 222],
                    'Wilson': ['C', 9, 194],
                    'Forsythe': ['2B', 5, 304],
                    'Souza Jr': ['RF', 2, 229],
                    'Longoria': ['3B', 3, 282],
                     }

0 个答案:

没有答案