# Tutor profile: Jude G.

## Questions

### Subject: Python Programming

When faced with a python-programming question what should I first do in order to tackle the problem effectively?

Every coding problem I am faced with goes something like this. Example question: Create a function called Fib that takes in an integer x and returns x's Fibonacci number. Step 1: Figure out what you know and don't know in the question. You pretty much do this as you're reading. But this step is important so you don't miss details of the question. Example: Do I know what a python function is and how to use it? Do I know what an integer is? Do I know what a Fibonacci number is? Step 2: Write pseudocode! A lot of programmers think writing code is a waste of time and they should go straight to typing. But I have found that people are much more likely to find their errors in their code and understand what it is doing on a deeper level when they write code. Also this will prepare you for coding interviews. Example: \begin{lstlisting} def Fib(number): ~ return Fibonacci of number \end{lstlisting} Step 3: I figure out what kind of structure I want the function to have? Example: I want this to be a recursive function because there are base cases when it comes to Fibonacci numbers and that is very similar to structure of recursive functions. Step 4: Fill in the details as best as I can and testing my code a long the way to make sure at least he basic parts of my code work. Example: \begin{lstlisting} def Fib(number): if n==1: return 0 elif n==2: return 1 else: return Fib(number - 1) + Fib(number -2) print("The Fibonacci number of 9 should be 21 and my program returns ",Fib(9)) >>The Fibonacci number of 9 should be 21 and my program returns 21 \end{lstlisting} I would have enough tests to be confidant in my program. Remember to test as you write your code. Not just when you get done with the whole program. You'll find that it well worth your time to do testing while you write your code so when you make an error that changes the whole format your program you wouldn't have waste a ton of time writing the whole program. Also remember it is okay to get lots of errors, even when you become experienced at programming you will always run into errors.

### Subject: Computer Science (General)

What are a advantage and disadvantage of using recursion?

Advantages If your program is repeats tasks using recursion can greatly increase the runtime. Using a recursion technique called memoization you can take the $O(n^{2})$ runtime of a normal recursive program down all the way to $O(n)$. Which is a HUGE optimization to your code! Disadvantage: Depending on your computer you can run into an error like "Stack-overflow". This can be compared to an infinite loop, where the loop never breaks, in a recursive function the keeps calling itself over and over again until it hits your computers recursion depth. Depending on the problem your are trying to solve it can be nearly impossible to use normal recursion. An example of this is trying to find the Fibonacci # of 100000. If you don't use other recursion techniques and your maximum recursion depth is 9999 then this problem is impossible to solve.

### Subject: Calculus

What is the point to take the derivatives and integrals of equations? Why can't I just draw the graph and find the values by looking at the graph?

Both taking the derivatives and integrals of an equation not only is faster when you are trying to understand its properties. Try this: Find the slope of the line $3x^{2}$ at x = 1, without using any calculus. Even if you use an online plotting tool it will a more time to find the slope than if you just used calculus. $\dfrac{d}{dx} 3x^{2} = 2 * 3 * x^{2 -1 } = 6x^{1}$ then set x = 1. The slope is 6 at x = 1. Not only will taking the derivative be substantially faster in the longer run but it is also gives you a quantitative result! Similarly with integrals. Taking the integral an exponential equation (example: $y(x) = e^{x}}$) is so much faster than you looking at a graph and trying to estimate the area under the curve (that is what integrals do). Hope that helped!

## Contact tutor

needs and Jude will reply soon.