Exercise: Debugging 101

Exercise on fixing code for a mathematician.

We'll cover the following

Task

The mathematician needs help. He wrote some code to calculate the square of two numbers. However, he wrote lots of unnecessary statements. His math and logic are correct. He correctly used loops and the addition statement to find the square while also using a function to sum two numbers together. But he doesn’t know how to satisfy his conditionals so that the code works smoothly. Fix his code such that only certain values are changed, not the entire code. We would not want to hurt the mathematician’s feelings by totally rewriting his code.

Get hands-on with 1200+ tech skills courses.