Question: PLease complete in python addcandidate(db, state, name, party, popular votes, electoral votes) Description: It accepts an existing database and a candidate name along with the
PLease complete in python
addcandidate(db, state, name, party, popular votes, electoral votes) Description: It accepts an existing database and a candidate name along with the relevant info. If the candidate and/or the State already exist, it updates their info, otherwise it adds a new record for the candidate and/or the State. The function assumes the length of the input and the types are correct, no need for this kind of checks. Parameters: database1 and details for a candidate Return value: None Examples add_candidate(db, "VA, 'Clinton, DEM, 1234567, 10) add candidate(db, TX, Trump, 'REP, 2345678, 23) None None remove candidate(db, name, state-None) Description: It removes a candidate from either one or all the States. Keep in mind that after removal dictionary keys cannot point to empty lists Parameters: database1, the abbreviated name of a candidate and the abbreviated name of a State. If state is not provided it will remove the candidate from all States. Reurn valuer Fase i state desnt esist in dicionar, None othervwse Examples remove_candidate(db, Clinton) remove candidate(db, Trump', TX) remove_candidate(db, Trump, VR) None None -False addcandidate(db, state, name, party, popular votes, electoral votes) Description: It accepts an existing database and a candidate name along with the relevant info. If the candidate and/or the State already exist, it updates their info, otherwise it adds a new record for the candidate and/or the State. The function assumes the length of the input and the types are correct, no need for this kind of checks. Parameters: database1 and details for a candidate Return value: None Examples add_candidate(db, "VA, 'Clinton, DEM, 1234567, 10) add candidate(db, TX, Trump, 'REP, 2345678, 23) None None remove candidate(db, name, state-None) Description: It removes a candidate from either one or all the States. Keep in mind that after removal dictionary keys cannot point to empty lists Parameters: database1, the abbreviated name of a candidate and the abbreviated name of a State. If state is not provided it will remove the candidate from all States. Reurn valuer Fase i state desnt esist in dicionar, None othervwse Examples remove_candidate(db, Clinton) remove candidate(db, Trump', TX) remove_candidate(db, Trump, VR) None None -False
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
