python-challenge

For PyPoll

First thing I did was open my csv file with the With Open syntax embeeded in python.

Secondly, I decalred my variables that I will be using to get started wtith the assignment.

Third, I make a script that can count the rows of each vote and give me back the total votes.

Fourth, under that for loop for total votes, I created a script with if statement that will read through list of candidates and add them to a list as it iterates.

Fifth, we initate the candidate votes into a list based on step 4

Sixth, we create a dictionary to store each candidates votes in with in a for loop to iterate through the candidate name list and give us the percentage of each candidates votes.

Then we intiate a winner variable to determine based on the number of votes and percentage from step 3 and 4, to return a string value which is a name.

last we call all the results with a print function outside of the loops which gives us each candidates votes, percentage of votes and popular vote.

For PyBank

First decalare variables you'll be using

second create a for loop to itereate through row 2 to give you total net amount and total months and append to a date list

third create a variable = to a list to append the numbers from the row with profits/losses

fourth within a for loop set the profits/loss == to the number list first index - number list last index to get difference

fifth outside the loop set Avg variable to profits/loss list divided by length of pl list list

sixth create a greatest increase list = profits/loss list and get index of max create a greates decrease list = profits/loss loss get index of the min

seventh set max amount to pl list set min amount to pl list