Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create field_goals.py that will ask for basketball stats and write the results to a file. Ask for the player's name, team, 2 point shot attempts,
Create field_goals.py that will ask for basketball stats and write the results to a file. Ask for the player's name, team, 2 point shot attempts, and the number made. Implement a function that will take the attempts and shots made as input and return the percentage as a real number (i.e., float). Write the player's name and field goal percentage to the team's file. Format the percentage to display a single decimal place with the % sign included. For example, a player that makes half of his shots should have a 50.0% field goal percentage (FG%). Use the append mode to write the results to a file that has the team name followed by "dat". Use a function to write the data to the file as well. Example run: Player's name? Jokic Player's team? Nuggets Number of field goal attempts: 849 Number of field goals made: 440 The output in the Nuggets.dat file should be: Jokic has a 51.8% field goal percentage
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started