TutorMe homepage
Subjects
PRICING
COURSES
Start Free Trial
Eric V.
3rd year Computer Science Major @ UCI
Tutor Satisfaction Guarantee
Python Programming
TutorMe
Question:

In regards to a 2-dimensional list, why can you change a value in the list by using a "for x in range" loop and not a "for x in" loop?

Eric V.

Consider a 2-d list called "L" When we say for "for x in range(len(L))" we loop through each individual index of L. (e.g. L, L, L, etc.) Therefore, when we say: for x in range(len(L)): L[x] += 1 we are going to each index and incrementing the value AT that index by 1. On the other hand, when we say "for x in L", we simply obtain a copy of the each value in L, without any reference to where the value we need to change is located within L.

Statistics
TutorMe
Question:

Consider a standard 52-card deck. If a card is randomly drawn from the deck, what is the probability that the card is either a "7" or a heart?

Eric V.

First, remember that there are four different "7"s in a standard deck (one for each suit) Second, remember that there are 13 different hearts in a standard deck The probability of success = # ways to succeed/total possible outcomes Therefore, the probability of drawing a "7" = 4/52 The probability of drawing a heart = 13/52 To calculate the probability of drawing a "7" OR a heart, we can simply add the probability of drawing a "7" to the probability of drawing a heart = 4/52 + 13/52. However, because a card that is both a "7" and a heart is included in BOTH probabilities above, we must subtract one of the probabilities (1/52 since there is only one way it can happen) so that we do not double count. Therefore, our answer to the above questions = 4/52 + 13/52 - 1/52 = 16/52 = 4/13.

Algebra
TutorMe
Question:

Bob has "x" number of bins. Each bin contains 6 balls. Bob has a total of 42 balls. How many bins does Bob have?

Eric V.

"x" is the number we are solving for. The total number of balls = (# of balls in each bin) x (# of bins) From this we can get: 42 = 6x To get "x" by itself, we must get rid of the "6". To do this, we divide by 6. But remember that if we do something to one side of the equation, we must do it to the other side as well. Therefore, we divide both sides by 6 and get the equation: 7 = x. Bob has 7 bins, each with 6 balls in them.

Send a message explaining your
needs and Eric will reply soon.
Contact Eric