You are on page 1of 2

Below is the table format representing the list of different data fields with their corresponding

Python data types and an example for each, along with the reasons for using these data
types:

Data field
Identifier Data Type Example Reason
Names may contain letters and
player_name String "Virat Kohli" other characters, making string the
appropriate data type.

Age is a whole number, and


age Integer 32 integers are suitable for
representing it.

Countries are represented by


country String "India" names, which can be stored as
strings.

Players may have represented


teams List ["RCB", "India"] multiple teams, and a list allows
storing multiple values.

Players can play in multiple


["Test", "ODI",
formats List formats, and a list suits storing
"T20"]
these formats.

Batting average can have decimal


batting_average Float 53.94 values, so a float is used to
represent it.

Example:-
# Define the data structure for individual player stats
player_stats = [
{
"player_name": "Virat Kohli",
"age": 32,
"country": "India",
"teams": ["Royal Challengers Bangalore", "India"],
"formats": ["Test", "ODI", "T20"],
"batting_average": 53.94,
"bowling_average": None,
"batting_style": "Right-handed",
"bowling_style": "Right-arm medium",
"total_runs": 7240,
"total_wickets": None,
"total_matches": 254,
"highest_score": 254,
"best_bowling_figures": None,
"strike_rate": 93.0,
"economy_rate": None,
},
# Add more players here
]

# Printing the player_stats list


for player in player_stats:
print("Player Name:", player["player_name"])
print("Age:", player["age"])
print("Country:", player["country"])
print("Teams:", ", ".join(player["teams"]))
print("Formats:", ", ".join(player["formats"]))
print("Batting Average:", player["batting_average"])
print("Bowling Average:", player["bowling_average"])
print("Batting Style:", player["batting_style"])
print("Bowling Style:", player["bowling_style"])
print("Total Runs:", player["total_runs"])
print("Total Wickets:", player["total_wickets"])
print("Total Matches:", player["total_matches"])
print("Highest Score:", player["highest_score"])
print("Best Bowling Figures:", player["best_bowling_figures"])
print("Strike Rate:", player["strike_rate"])
print("Economy Rate:", player["economy_rate"])
print("\n")

You might also like