Advertisement
Xamuel

Stackoverflow Code Sample 1

May 18th, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.59 KB | None | 0 0
  1. First code example:
  2.  
  3.  
  4. class football:
  5.     def __init__(self,qb,num):
  6.         self.qb = qb
  7.         self.num = num
  8.  
  9.     def __str__(self):
  10.         return self.qb + ", " + self.num
  11. teams = {
  12. "Niners" : football("Gabbert", "02" ),
  13. "Bears" : football("CUTLER, JAY","06"),
  14. "Bengals" : football ("Dalton, Andy","14"),
  15. "Bills" : football (" Taylor, Tyrod", "05"),
  16. "Broncos" : football ("Sanchez, Mark", "06"),
  17. "Browns" : football ("MCCOWN, JOSH", "13"),
  18. "Bucaneers" : football ("Winston, Jameis", "03"),
  19. "Cardinals" : football ("PALMER, CARSON", "03"),
  20. "Chargers" : football ("RIVERS, PHILIP", "17"),
  21. "Cheifs" : football ("SMITH, ALEX", '11'),
  22. "Colts" : football ("Luck, Andrew",' 12' ),
  23. "Cowboys" : football ("Romo,Tony","09"),
  24. "Dolphins" : football ("Tannehill, Ryan", '17' ),
  25. "Eagles" : football ("Bradford, Sam", '07'),
  26. "Falcons" : football ("RYAN, MATT",' 02' ),
  27. "Giants" : football ("MANNING, ELI", '10' ),
  28. "Jaguars" : football ("Bortles, Blake", '05'),
  29. "Jets" : football ("Smith, Geno",' 07' ),
  30. "Lions" : football ("Stafford, Matthew", '09' ),
  31. "Packers" : football ("RODGERS, AARON", '12'),
  32. "Panthers" : football ("Newton, Cam",' 01' ),
  33. "Patriots" : football ("BRADY, TOM", '12'),
  34. "Raiders" : football ("Carr, Derek",' 04'),
  35. "Rams" : football ("Foles, Nick", '05'),
  36. "Ravens" : football ("FLACCO, JOE",' 05'),
  37. "Redskins" : football ("Cousins, Kirk", '08'),
  38. "Saints" : football ("BREES, DREW",' 09' ),
  39. "Seahawks" : football ("Wilson, Russell", '03'),
  40. "Steelers" : football ("ROETHLISBERGER, BEN",' 07'),
  41. "Texans" : football ("Osweiler, Brock", '17'),
  42. "Titans" : football ("Mariota, Marcus",' 08' ),
  43. "Vikings" : football ("Bridgewater, Teddy", '05' )}
  44.  
  45. def decor(func):
  46.     def wrap():
  47.         print("===============================")
  48.         func()
  49.         print("===============================")
  50.     return wrap
  51.  
  52. def print_text():
  53.     print("Who\s your NFL Quarterback? ")
  54.  
  55. decorated = decor(print_text)
  56. decorated()
  57.  
  58. team = input("Enter your teams name here:").capitalize()
  59. print(teams[team])
  60.  
  61.  
  62.  
  63.  
  64. Second code example:
  65.  
  66.  
  67. teams = {
  68. "Niners" : ("Gabbert", "02" ),
  69. "Bears" : ("CUTLER, JAY","06"),
  70. "Bengals" : ("Dalton, Andy","14"),
  71. "Bills" : (" Taylor, Tyrod", "05"),
  72. "Broncos" : ("Sanchez, Mark", "06"),
  73. "Browns" : ("MCCOWN, JOSH", "13"),
  74. "Bucaneers" : ("Winston, Jameis", "03"),
  75. "Cardinals" : ("PALMER, CARSON", "03"),
  76. "Chargers" : ("RIVERS, PHILIP", "17"),
  77. "Cheifs" : ("SMITH, ALEX", '11'),
  78. "Colts" : ("Luck, Andrew",' 12' ),
  79. "Cowboys" : ("Romo,Tony","09"),
  80. "Dolphins" : ("Tannehill, Ryan", '17' ),
  81. "Eagles" : ("Bradford, Sam", '07'),
  82. "Falcons" : ("RYAN, MATT",' 02' ),
  83. "Giants" : ("MANNING, ELI", '10' ),
  84. "Jaguars" : ("Bortles, Blake", '05'),
  85. "Jets" : ("Smith, Geno",' 07' ),
  86. "Lions" : ("Stafford, Matthew", '09' ),
  87. "Packers" : ("RODGERS, AARON", '12'),
  88. "Panthers" : ("Newton, Cam",' 01' ),
  89. "Patriots" : ("BRADY, TOM", '12'),
  90. "Raiders" : ("Carr, Derek",' 04'),
  91. "Rams" : ("Foles, Nick", '05'),
  92. "Ravens" : ("FLACCO, JOE",' 05'),
  93. "Redskins" : ("Cousins, Kirk", '08'),
  94. "Saints" : ("BREES, DREW",' 09' ),
  95. "Seahawks" : ("Wilson, Russell", '03'),
  96. "Steelers" : ("ROETHLISBERGER, BEN",' 07'),
  97. "Texans" : ("Osweiler, Brock", '17'),
  98. "Titans" : ("Mariota, Marcus",' 08' ),
  99. "Vikings" : ("Bridgewater, Teddy", '05' )}
  100.  
  101. def decor(func):
  102.     def wrap():
  103.         print("===============================")
  104.         func()
  105.         print("===============================")
  106.     return wrap
  107.  
  108. def print_text():
  109.     print("Who\s your NFL Quarterback? ")
  110.  
  111. decorated = decor(print_text)
  112. decorated()
  113.  
  114. team = input("Enter your teams name here:").capitalize()
  115. print(teams[team][0], teams[team][1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement