FIX THIS CODE
Using python Application
CODE:
import csv
playersList = []
with open('Players.csv') as f:
rows = csv.DictReader(f)
for r in rows:
playersList.append(r)
teamsList = []
with open('Teams.csv') as f:
rows = csv.DictReader(f)
for r in rows:
teamsList.append(r)
plays=len(playersList)
for i in range(plays):
if playersList[i]['team']=='Argentina' and int(playerlist[i]['minutes played'])<200 and int(playersList[i]
['shots'])>20:
print(playersList[i]['last name'])
c0=0
c1=0
c2=0
for i in range(len(teamsList)):
if int(teamsList[i]['redCards'])==0:
c0=c0+1
if int(teamsList[i]['redCards'])==1:
c1=c1+1
if int(teamsList[i]['redCards'])==2:
c2=c2+1
print("Number of teams with zero redcards:",c0)
print("Number of teams with zero redcards:",c1)
print("Number of teams with zero redcards:",c2)
ratio=0
for i in range(len(teamsList)):
if int(teamsList[i]['games']>3) and if int(teamsList[i]['goalsFor'])/int(teamsList[i]['goalsAgainst'])<ratio:
ratio=int(teamsList[i]['goalsFor'])/int(teamsList[i]['goalsAgainst'])<ratio
print('team with lowest ratio')
for i in range(len(teamsList)):
if int(teamsList[i]['games']>3) and if int(teamsList[i]['goalsFor'])/int(teamsList[i]['goalsAgainst'])==ratio:
print(teamsList[i]['teams'])
ind=0
avg=-99999
for i in range(len(teamsList)):
if int(teamsList[i]['goalFor'])//int(teamsList[i]['games'])>avg:
avg=int(teamsList[i]['goalFor'])//int(teamsList[i]['games']
ind=i
print('The team with highest goalsFor per game on average:')
for i in range(len(teamsList)):
if int(teamsList[i]['goalFor'])//int(teamsList[i]['games'])==avg:
print(teamsList[i]['team'])
ind1=0
avg1=-99999
for i in range(len(teamsList)):
if int(teamsList[i]['passes'])//int(teamsList[i]['games'])>avg1:
avg1=int(teamsList[i]['passes'])//int(teamsList[i]['games']
ind1=i
print('The team with highest total passed per game on average:')
for i in range(len(teamsList)):
if int(teamsList[i]['passes'])//int(teamsList[i]['games'])==avg1:
print(teamsList[i]['name'])
avg3=sum(playersList[:]['passes'])/len(playersList[:]['passes'])
for i in range(len(playersList)):
if playersList[i]['passes']>avg3:
print(playersList[i]['position'])
Step by stepSolved in 4 steps with 1 images
- OCaml Code: The goal of this project is to understand and build an interpreter for a small, OCaml-like, stackbased bytecode language. Make sure that the code compiles correctly and provide the code with the screenshot of the output. The code must have a function that takes a pair of strings (tuple) and returns a unit. You must avoid this error that is attached as an image. Make sure to have the following methods below: -Push integers, strings, and names on the stack -Push booleans -Pushing an error literal or unit literal will push :error: or :unit:onto the stack, respectively -Command pop removes the top value from the stack -The command add refers to integer addition. Since this is a binary operator, it consumes the toptwo values in the stack, calculates the sum and pushes the result back to the stack - Command sub refers to integer subtraction -Command mul refers to integer multiplication -Command div refers to integer division -Command rem refers to the remainder of integer…arrow_forwardCode NOT working. What to do? Here is code: appleList = [["Apple",52,14,0,0],["McIntosh red",80,18,0,0.5],["Gala (Apple)",52,11.4,0.2,0.3],["Fuji Apple",52,11.4,0.2,0.3],["Honey Crisp Apples",90,21,0,0],["Granny Smith Apples",52,11.4,0.2,0.3],["Red Delicious Apples",80,17,0,0],["Braeburn Apples",71.7,16,0.5,0.1],["Golden Delicious Apples",130,29,1,0],["Jonagold",130.7,34,1,0],["Cripps Pink Apple",80,18,0,0],["Empire Apples",80,17,0,0],["Produce Cortland Apples",70,6,1,5],["Jazz Apples",53.8,12,0.6,0.5],["Cameo Apples", 80,22,0,0]["Winesap Apples",80,22,0,0],["Rome Apples",80,22,0,0],["Ambrosia Apples",90,17,0.4,0],] print(":Type of Apple : Calories : Carbs (in GRAMS) : Protein (in GRAMS) : Fat (in GRAMS) :") for item in appleList:print(":",item[0]," "*(9-len(item[0])),":",item[1]," "*(13-len(item[1])),":",item[2]," "*(4-len(str(item[2]))),":")arrow_forwarddef upgrade_stations(threshold: int, num_bikes: int, stations: List["Station"]) -> int: """Modify each station in stations that has a capacity that is less than threshold by adding num_bikes to the capacity and bikes available counts. Modify each station at most once. Return the total number of bikes that were added to the bike share network. Precondition: num_bikes >= 0 >>> handout_copy = [HANDOUT_STATIONS[0][:], HANDOUT_STATIONS[1][:]] >>> upgrade_stations(25, 5, handout_copy) 5 >>> handout_copy[0] == HANDOUT_STATIONS[0] True >>> handout_copy[1] == [7001, 'Lower Jarvis St SMART / The Esplanade', \ 43.647992, -79.370907, 20, 10, 10] True """arrow_forward
- Do not add import statementsarrow_forwardStrings all_colors and updated_value are read from input. Perform the following tasks: Split all_colors into tokens using a comma (',') as the separator and assign color_list with the result. Replace the first element in color_list with updated_value.arrow_forwardQuestion R .Full explain this question and text typing work only We should answer our question within 2 hours takes more time then we will reduce Rating Dont ignore this linearrow_forward
- In binary search: A colors list is searched for Tan using binary search. Colors list: ( Beige, Blue, Brown, Gray, Indigo, Magenta, Maroon, Orange, Tan, Teal ) What is the first color searched? What is the second color searched?arrow_forwardSelect all answers that apply. In which of the following scenarios is using a vector less efficient than using a list? O A program that frequently needs to access elements throughout the the container O A program that needs to add a large number of elements to the beginning of the container A program that adds a fixed number of elements and then repeatedly removes the first element O A program that frequently adds elements, but only to the end of the containerarrow_forwardA map is a container that stores a collection of ordered pairs, each pair consists of a key and a value, <key, value>. Keys must be unique. Values need not be unique, so several keys can map to the same values. The pairs in the map are sorted based on keys. Group of answer choices True Falsearrow_forward
- In C++.arrow_forwardPython question please include all steps and screenshot of code. Also please provide a docstring, and comments throughout the code, and test the given examples below. Thanks. Suppose that you are given a list of strings representing a deck of 52 cards. Write afunction called bridgeHands() which takes the list as its only parameter. It shuffles the listand divides it into 4 hands (tuples) of 13 cards each. It returns a dictionary in which thekeys are the strings 'North', 'South', 'East', and 'West', with each key corresponding to adifferent one of the hands.arrow_forwarddef upgrade_stations(threshold: int, num_bikes: int, stations: List["Station"]) -> int: """Modify each station in stations that has a capacity that is less than threshold by adding num_bikes to the capacity and bikes available counts. Modify each station at most once. Return the total number of bikes that were added to the bike share network. Precondition: num_bikes >= 0arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education