Subjects
PRICING
COURSES
SIGN IN
Start Free Trial
Nathan P.
Tutor for 2 years, Software Engineering Intern @ Indeed, UC Berkeley Grad Dec 2017
Tutor Satisfaction Guarantee
Python Programming
TutorMe
Question:

If I want to make a list of numbers that contains every third number from 0 - 100 exclusive in reverse order, how would you do it? Now apply a function that multiplies every number in that list by 4. How would you do that.

Nathan P.
Answer:

For every step of the process i have provided two different ways of approaching the problem: Get List of every 3rd Number from 0 - 100: Method 1: list comprehension and splicing. oddNum = [i for i in range(100)][::-3] Method 2: range function with multiple paramters oddNum = list(range(0, 100, 3))[::-1] # this gets an iterator of ever third number from 0 to 100. Then it gets the list and finally using the slicing opperator [::-1], reverses the list ----------------------------------------------------------------------------------------------------------------------------------------- Create a function that returns 4 times the input parameter: Method 1: normal function definition To apply the function to the entire list, first create the function. def quadruple(x): # the name of the function is quadruple return x *4 Method 2: Lambda Functions quadruple = lambda x: x * 4 ----------------------------------------------------------------------------------------------------------------------------------------- Multiply every element of the list by 4: Method 1: List comprehension again now to apply quadruple fn to every element of the list oddNum, you can use another list comprehension like so: oddNum = [quadruple(elem) for elem in oddNum] Method 2: Map function oddNum = list(map(quadruple, oddNum))

Java Programming
TutorMe
Question:

What will the JVM print if the following you call the following method: public static void equalityCheck(int a, int b) { if (new Integer(a) == new Integer(b)) { System.out.println("EQUAL"); } else { System.out.println("NOT EQUAL"); } }

Nathan P.
Answer:

It will print EQUAL if a and b are in between the values of -127 and 128, else it will print NOT EQUAL. This is because Java does something call Autoboxing and Unboxing. This is where certain classes, such as Integers are wrapped in a Class and thus the '==' operator that checks for a object equality fails. However, numbers between -127 and 128 are cached such that they are understood as primitives and when the '==' operator is used on primitives, it checks for value equality, not reference equality.

Algebra
TutorMe
Question:

How would you reduce the following fraction? $$\frac{4*(2x-1)(x-3)}{12x^2 -52x + 48}$$

Nathan P.
Answer:

We are given the fraction $$\frac{4*(2x-1)(x-3)}{12x^2 -52x + 48}$$. First factor the bottom so we can attempt to simplify: $$12x^2 -52x + 48 = 4(3x^2 - 13x + 12) = 4(3x - 4)(x - 3)$$ We can now say that $$\frac{4*(2x-1)(x-3)}{12x^2 -52x + 48} = \frac{4*(2x-1)(x-3)}{4(3x - 4)(x - 3)}$$. Cross out the $$4$$ and $$x-3$$ on top and bottom to get $$\frac{2x-1}{3x - 4}$$ Thus, $$\frac{4*(2x-1)(x-3)}{12x^2 -52x + 48}$$ simplifies to $$\frac{2x-1}{3x - 4}$$

Send a message explaining your
needs and Nathan will reply soon.
Contact Nathan
Ready now? Request a lesson.
Start Session
FAQs
What is a lesson?
A lesson is virtual lesson space on our platform where you and a tutor can communicate. You'll have the option to communicate using video/audio as well as text chat. You can also upload documents, edit papers in real time and use our cutting-edge virtual whiteboard.
How do I begin a lesson?
If the tutor is currently online, you can click the "Start Session" button above. If they are offline, you can always send them a message to schedule a lesson.
Who are TutorMe tutors?
Many of our tutors are current college students or recent graduates of top-tier universities like MIT, Harvard and USC. TutorMe has thousands of top-quality tutors available to work with you.