Skip to content

Instantly share code, notes, and snippets.

@lawlesst
Forked from anonymous/gist:2184239
Created March 24, 2012 15:23
Show Gist options
  • Save lawlesst/2184245 to your computer and use it in GitHub Desktop.
Save lawlesst/2184245 to your computer and use it in GitHub Desktop.
Hot dog pricing data
hotdog_years = ["2011", "2010", "2009"]
hotdog_data = [{"Team":"Boston Red Sox","TeamID":"redsox","2011":4.5,"2010":4.5,"2009":4.5},
{"Team":"New York Yankees","TeamID":"yankees","2011":3,"2010":3,"2009":3},
{"Team":"Chicago Cubs","TeamID":"cubs","2011":4.5,"2010":4.25,"2009":3},
{"Team":"Chicago White Sox","TeamID":"whitesox","2011":3.5,"2010":3.25,"2009":3.25},
{"Team":"New York Mets","TeamID":"mets","2011":5,"2010":5,"2009":4.75},
{"Team":"Philadelphia Phillies","TeamID":"phillies","2011":3.75,"2010":3.75,"2009":3.75},
{"Team":"Los Angeles Dodgers","TeamID":"dodgers","2011":5,"2010":5,"2009":5},
{"Team":"St. Louis Cardinals","TeamID":"cardinals","2011":4.25,"2010":4,"2009":4},
{"Team":"Houston Astros","TeamID":"astros","2011":4.75,"2010":4.75,"2009":4.75},
{"Team":"Minnesota Twins","TeamID":"twins","2011":3.75,"2010":3.75,"2009":3.5},
{"Team":"Toronto Blue Jays","TeamID":"bluejays","2011":5.11,"2010":5,"2009":3.8},
{"Team":"San Francisco Giants","TeamID":"giants","2011":4.75,"2010":4.5,"2009":4.25},
{"Team":"Detroit Tigers","TeamID":"tigers","2011":4,"2010":3,"2009":3.5},
{"Team":"Washington Nationals","TeamID":"nationals","2011":4.5,"2010":4.5,"2009":4.5},
{"Team":"Seattle Mariners","TeamID":"mariners","2011":3.5,"2010":3.5,"2009":4.25},
{"Team":"Oakland Athletics","TeamID":"athletics","2011":3.5,"2010":3.5,"2009":3.5},
{"Team":"Baltimore Orioles","TeamID":"orioles","2011":2.5,"2010":2.5,"2009":2.5},
{"Team":"Cleveland Indians","TeamID":"indians","2011":4.25,"2010":4.25,"2009":4.25},
{"Team":"Florida Marlins","TeamID":"marlins","2011":5,"2010":5,"2009":5},
{"Team":"Atlanta Braves","TeamID":"braves","2011":4.5,"2010":4.25,"2009":4.25},
{"Team":"Cincinnati Reds","TeamID":"reds","2011":1,"2010":1,"2009":1},
{"Team":"Colorado Rockies","TeamID":"rockies","2011":3.25,"2010":3.25,"2009":3.25},
{"Team":"Milwaukee Brewers","TeamID":"brewers","2011":3.25,"2010":3.25,"2009":2.75},
{"Team":"Kansas City Royals","TeamID":"royals","2011":4,"2010":4,"2009":4},
{"Team":"Texas Rangers","TeamID":"rangers","2011":4.75,"2010":4.75,"2009":2.75},
{"Team":"Tampa Bay Rays","TeamID":"rays","2011":5,"2010":5,"2009":5},
{"Team":"Los Angeles Angels","TeamID":"angels","2011":3,"2010":3,"2009":3},
{"Team":"Pittsburgh Pirates","TeamID":"pirates","2011":2.75,"2010":2.5,"2009":2.5},
{"Team":"San Diego Padres","TeamID":"padres","2011":4,"2010":4,"2009":4},
{"Team":"Arizona Diamondbacks","TeamID":"diamondbacks","2011":2.75,"2010":2.75,"2009":3.5}]
def get_hotdog_price(team, year):
if not year in hotdog_years:
return -1
for i in range(len(hotdog_data)):
if hotdog_data[i]['TeamID'] == team:
price = hotdog_data[i][year]
return price
return -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment