0% found this document useful (0 votes)
4 views2 pages

Corection

CS class 12

Uploaded by

vedantbriya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Corection

CS class 12

Uploaded by

vedantbriya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

def display_team_info(team_data, players_data):

if team_data:
print("Team Image:")
print("\n","\n","\n","\n","\n","\n","\n","
. \n","\n","\n","\n","\n","\n","\n","\n")
try:
img = Image.open(team_data[2]) # Team
. image path
img.show()
except Exception as e:
print(f"Error opening team image: {e}")

print("\nPlayers:")
for player in players_data:
print(f"Name: {player[1]}, Role: . . . .

. {player[2]}, Runs: {player[4]}, . .

. Wickets: {player[5]}")

print("\nOwner Image:")
print("\n","\n","\n","\n","\n","\n","\n","\n
. ","\n","\n","\n","\n","\n","\n","\n","\n")
try:
owner_img = Image.open(team_data[4])
owner_img.show()
except Exception as e:
print(f"Error opening owner image: {e}")

print("Owner Name:", team_data[3])


print("Owner Description:", team_data[5])
else:
print("Team not found.")

# Function to display player information


def display_player_info(player_data):

if player_data:
print(f"Name: {player_data[1]}")
print(f"Role: {player_data[2]}")
if player_data[2] == "Batsman":
print(f"Runs: {player_data[3]}")
elif player_data[2] == "Bowler":
print(f"Wickets: {player_data[4]}")
10
elif player_data[2] == "Wicketkeeper":
print(f"Stumpings: {player_data[5]}")
else:
print("Player not found.")

# Function to list players by role


def list_players_by_role(role):

connection = mysql.connector.connect(
host="localhost",
user="root",
password="12345",
database="ipl_data"
)
cursor = connection.cursor()

# Query to select players by role without duplicates


cursor.execute("SELECT DISTINCT name, team_id, .
. role, runs, wickets FROM players .
. WHERE role = %s", (role,))
players = cursor.fetchall()

if players:
print(f"\nList of {role}s:")
for player in players:
name, team_id, role, runs, wickets = . . .

. player

# If the role is bowler, show only wickets, else show runs


if role.lower() == "bowler":
print(f"Name: {name}, Team ID: . . .
. {team_id}, Role: {role}, . . .
. Wickets: {wickets}")
else:

11

You might also like