Computer Science 2
*********
*********
Due Date: April 17, 2024

Python Program about Banking

Purpose: We are going to create a Python program
that simulates a bais bank account system. Complete the assignment below:





*********
*********
Due Date: April 22, 2024

Python Program about a soccer tournaments

Purpose: We are going to create a Python program
that simulates a soccer tournament. Complete the assignment below:
Let's create a Python program that simulates a soccer tournament with real professional teams. We'll use a simple elimination format for a 10-team tournament. This will involve generating random scores for matches and advancing the winner until a champion is declared. Here's a more detailed explanation of the program structure: List of Teams: We'll include 10 real professional soccer teams. Tournament Setup: The teams will be randomly matched in the first round. Since we have 10 teams, 8 teams will compete in the first round, and 2 will receive a bye to the second round. Match Simulation: Each match will have random scores generated for the two teams. Advancement: Winners will advance to the next round. This will continue until the championship match. Championship: The last two teams will compete for the title. Result Output: The program will display the results of each match and ultimately the champion. Here's the Python code to simulate this tournament: You will need to create the following 3 files: PX_Soccer_lastname.py (Actual python program) PX_Soccer_lastname.png (Screen shot of program running in the IDE) PX_Soccer_lastname.mp4 (Video) (Explaining the program and running the program) /* Instructions: * Copy the python program code below. */ import random def simulate_match(team1, team2): score1 = random.randint(0, 5) score2 = random.randint(0, 5) result = f"{team1} {score1} - {score2} {team2}" if score1 > score2: winner = team1 elif score2 > score1: winner = team2 else: # In case of a draw, we simulate extra time winner = team1 if random.random() > 0.5 else team2 result += f" (Extra time win by {winner})" return winner, result def simulate_tournament(teams): results = [] while len(teams) > 1: next_round = [] random.shuffle(teams) # Shuffle teams for pairing if len(teams) % 2 == 1: next_round.append(teams.pop()) # Give bye to one team if odd number of teams while teams: team1 = teams.pop() team2 = teams.pop() winner, result = simulate_match(team1, team2) next_round.append(winner) results.append(result) teams = next_round return results, teams[0] # Return all match results and the champion # List of teams teams = [ "Manchester United", "Liverpool", "Barcelona", "Real Madrid", "Bayern Munich", "Paris Saint-Germain", "Juventus", "Chelsea", "Manchester City", "AC Milan" ] results, champion = simulate_tournament(teams.copy()) print("\nTournament Results:") for result in results: print(result) print("\nChampion:", champion) How It Works: simulate_match: Simulates a match between two teams and determines a winner. In case of a draw, a random "extra time" winner is chosen. simulate_tournament: Conducts all the rounds of the tournament until a champion is determined. Team list: You can modify this list to include any set of professional teams you like. This program gives a complete, albeit simple, soccer tournament simulation. You can extend it by incorporating specific game rules, a group stage, or player-specific stats.

*********
*********
*********

Resources you may need and select Web addresses you may need (Below)

*********
*********
*********
 
-Locate your Cyber Range Passwords below by seat number.
Cyber Range Sign on ids and passwords (Period 7)
Click here and get your id and password.

Click here for your cyber range.
https://apps.cyber.org/login

*********
*********

-Using Linux and the python interpreter

If you have forgotten how to boot up your Kali Linux machine and run python.
Click here for full instructions.