Subjects
PRICING
COURSES
Start Free Trial
Tyler D.
Cyber Security Consultant, Tutor for 5 years
Tutor Satisfaction Guarantee
Python Programming
TutorMe
Question:

I am trying to write a program to check if a word is a palindrome (the same forwards and backwards) like "Bob" or "race car". Do you think you could help?

Tyler D.

Of course! First, let's use your examples to avoid some issues ahead of time. Starting with your first example, "Bob". As a human, you know that "B" and "b" are the same letter. But, to a computer, these are different because one is uppercase and one is lowercase. So we need to make all the letters the same case.. do you know how to do that? Correct! We can use the "lower" method. Something like: $$word.lower()$$ Now, let's look at your second example there.. "race car". Again, as a human, we understand that the space in between the words doesn't "count" as a letter when checking if it is the same forwards and backwards. But, to a computer, the space does count. So we need to get rid of that space.. do you know how to do that? That's right! With "string replace". Something like: $$word.replace("\ ",\ "")$$ Now that we have all the spaces removed, let's take a look at the meat and potatoes of the problem. How do we check if a word is a palindrome? One way would be to check the first letter against the last letter, the second letter against the second to last letter, etc. But this could be a little tricky to count. What else could we do? Maybe let the computer do all the hard work, right? What if we just reverse the word and let the computer compare the two to see if they are the same? Sounds easier don't you think? I will let you figure out how to reverse a string in Python, there are lots of creative ways to do it. You can call back or check online if you get stuck!

Geometry
TutorMe
Question:

I am having a hard time understanding/memorizing the equation for the surface area a cylinder. Could you help explain it to me?

Tyler D.

Sure! The best way to "memorize" equations is to understand where they come from. We can start with the equation itself, then break it down from there: $$Surface Area = 2(\pi r^2)+2\pi rh$$ $$r:radius\ of\ top\ and\ bottom\ circles,\ h: height\ of\ cylinder$$ What a doozie... Let's start with the first part, $$2(\pi r^2)$$. The area of a circle equals $$\pi r^2$$, where r is the radius of the circle. For example, if you have a circle with a radius of 5, the area would be: $$\pi 5^2$$, or $$25\pi$$. Since we have a circle on the top and bottom of our cylinder, we need to include two of these areas. This is why we begin with $$2(\pi r^2)$$. Now let's move onto the second part. We need to find the area of the side of the cylinder. Have you ever taken the wrapper off of a Gatorade bottle or bottle of water? If you take it off and lay it flat on a table, it is just a rectangle. Finding the area of a rectangle is easy enough, right? $$Area = length*height$$. The height is easy, that is just the height of the cylinder, h. The length is a little tricky. The rectangle was just wrapped around the circles, right? So the length of the rectangle is just the length of the outside of the circles, or their circumference. $$Circumference = 2\pi r$$. So for the rectangle, the area is just: $$Area = length * height$$ $$Area = 2\pi r * h$$ Now let's put it all together! $$Surface\ Area = Area\ of\ Top\ Circle + Area\ of\ Bottom\ Circle + Area\ of\ Rectangular\ Side$$ $$Surface\ Area = \pi r^2 + \pi r^2 + 2\pi r h$$ $$Surface\ Area = 2(\pi r^2) + 2\pi r h$$ There you go! Now you will never forget it.. right?

Algebra
TutorMe
Question:

I am using flash cards to help my son/daughter prepare for Algebra II over the summer before the next school year starts. I am confused why some of them have multiple answers.. like this one for instance: Solve the following expression $$(x+3)^2 = 36$$. On the back of the card, it gives me two answers in weird brackets.. why is that?

Tyler D.

Well, let's start by solving the expression step-by-step, and the reason for multiple answers will make sense to you shortly. First, we need to get rid of the exponent, the "squared" part. So we will take the square root of both sides to cancel out the "squared" operation. $$\sqrt{(x+3)^2}=\sqrt{36}$$ This simplifies down to: $$(x+3)=\pm6$$ Wait a minute.. where did that symbol come from? This symbol means "plus minus" which means the six can either be positive or negative. You see, $$6^2=36$$, but also $$(-6)^2=36$$. Because of this, $$\sqrt{36}$$ equals both $$6$$ and $$-6$$. Therefore, we need to solve two different expressions: $$x+3=6$$ and $$x+3=-6$$. For each expression, we just need to subtract 3 from both sides to cancel out the $$+3$$ operation: $$x+3-3=6-3$$ and $$x+3-3=-6-3$$ These simplify down to: $$x=3$$ and $$x=-9$$. All of this boils down to the fact that in the original expression, "x" can either be 3 or -9. To check this, let's put both numbers into the original expression: $$(3+3)^2=36$$ $$6^2=36$$ $$36=36$$, check! $$(-9+3)^2=36$$ $$(-6)^2=36$$ $$36=36$$, check! So the answer on the card shows $$x=\{-9,3\}$$.

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