# Tutor profile: Taylor P.

## Questions

### Subject: Python Programming

You are given a list named states which has already taken in data from a survey in which participants recorded which state they currently live in. The list looks like this: states_list = ['Michigan', 'Indiana', 'Iowa', 'Indiana', 'Nebraska', 'Iowa', 'Alaska', 'Indiana', 'Hawaii'] Create a function called states_pop which takes a list as input and returns a dictionary outlining how many people from the survey are from each state.

Code: states_list = ['Michigan', 'Indiana', 'Iowa', 'Indiana', 'Nebraska', 'Iowa', 'Alaska', 'Indiana', 'Hawaii'] def states_pop(l): d = {} for state in l: if state not in d: d[state] = 0 d[state] += 1 return d states_pop(states_list) Description: In this code, you can see the starting list is still states_list. The function states_pop is defined and takes in l as a parameter (meant to be a list - which is why states_list is plugged in later). First, the dictionary d must be created in order to store the information we want to sort through when we go through the list. Then, you make a for loop in order to iterate through each state in the list that is provided for input. So the "for state in l" line allows you to begin at the start of the list and will iterate through the entire list after executing everything that is within the loop. Once you begin iterating through the list, inside the for loop is what you will do for each element in the states_list. So for each element, we are checking to see if the state name is already present in the dictionary. This is necessary to make sure that we are not resetting the amount given to each state in the dictionary to 1 each time. When determining if a state is present, you say if state not in d (which is what the dictionary is named) and you would initialize the state to as the key name and the value as 0. So once you determine if the state was in the dictionary or not, you will add 1 to the value of the state, making sure it is accounted for. This is done for every state by using the for loop and at the end of the function, the dictionary (d) is returned.

### Subject: Statistics

Approximately 7 percent of all animals born in a certain region are Zebras. Of these zebras, 41 percent are males. Of all of the other animals born in the region, 52 percent are males. What is the probability that a randomly selected animal born in the region is a male?

To find the probability if a random animal selected from the region is a male, you must consider each of the groups separately (zebras and non zebras) and add them together in order to understand the true probability. Let Z stand for zebra, M stand for male, and N stand for non zebra. So P(Z) would mean the probability of a zebra, and would equal 0.07 since 7 percent of the animals in the region are Zebras. P(M | Z) reads as the probability an animal is a male, given that the animal is a zebra, so this would equal how many males are born within the zebras. The probability that a randomly selected animal is a male is: P(M) = P(Z)*P(M | Z) + P(N)*P(M | N) This formula takes into account the males in the zebra population and the males in the non zebra population and adds the weighted probabilities in order to determine how likely an animal is to be born a male in the whole population. P(M) = (0.07)*(0.41) + (0.93)*(0.52) = 0.5123

### Subject: Algebra

For a given input value of x, the function f outputs a value y in order to satisfy the following equation: 3y - x + 17 = 4(x - 2) What is the formula f(x) in terms of x?

To answer this problem, first you must understand that f(x) and y mean the same thing in this sense. Since we are trying to solve the formula in terms of x, and x is in the input described in the instructions, that means y will be the variable that is the output, and x is the variable which the function is based upon. This shows us that we want to get y alone on the left side of the equation, and move everything else over to the left side so we know what the function looks like. You must also understand that, when combining terms to get a variable alone, you make sure to perform the opposite operation from what is already being done to both sides of the equation. For example, if the left side says 3x + 17, you would have to subtract 17 from both sides of the equation to cancel it out. Then, you would divide all terms by 3 in order to get x alone. You first must multiply x and 2 by 4 on the right side of the equation in order to simplify that side so you can combine like terms later in the problem. After this step, your equation will look like: 3y - x + 17 = 4x - 8 Then you must add x to both sides, cancelling it out on the left and adding it to the 4x on the right, making it 5x. 3y + 17 = 5x - 8 Then you must subtract 17 from both sides in order to cancel it out on the left and add 17 to the 8 which is on the right. The trick here is that, since we are subtracting 8 from 5x, the 8 is technically negative in this sense. Therefore, you are performing (-8 + 17) which is a positive 9. 9. 3y = 5x + 9 Lastly, you must divide all terms by 3 in order to get y alone. This leaves your final equation as: y = (5/3)x + 3 Students should understand that y and f(x) are equivalent, so f(x) = (5/3)x + 3

## Contact tutor

needs and Taylor will reply soon.