Title
- Title: MLB Players
- layout: notebook
- categories: [jupyter]
This post contains some information about two of my favorite baseball players.
#Append to player profile of Manny Machado in his 10 year career in MLB
InfoDb = []
InfoDb.append({
"FirstName": "Manny",
"LastName": "Machado",
"Position": "Third Base",
"MLB Debut": "August 9, 2012",
"Batting Average": ".282",
"Career OPS": ".833",
"Teams": ["Baltimore Orioles", "Los Angeles Dodgers", "San Diego Padres"]
})
#Append to player profile of Aaron Judge in his 6 year career in MLB
InfoDb.append({
"FirstName": "Aaron",
"LastName": "Judge",
"Position": "Outfield",
"MLB Debut": "August 13, 2016",
"Batting Average": ".280",
"Career OPS": ".963",
"Teams": ["New York Yankees"]
})
def print_data(d_rec):
print(d_rec["FirstName"], d_rec["LastName"])
print("\t", "Position:", d_rec["Position"])
print("\t", "MLB Debut:", d_rec["MLB Debut"])
print("\t", "Batting Average:", d_rec["Batting Average"])
print("\t", "Career OPS:", d_rec["Career OPS"])
print("\t", "Teams: ", end="")
print(", ".join(d_rec["Teams"]))
print()
def for_loop():
print("For loop output\n")
for record in InfoDb:
print_data(record)
for_loop()