21.21. Introduction to Problem Types¶
Please read the following, watch the videos, and try to solve the problems.
21.21.1. Solving Mixed-up Code Problems¶
If you see a problem like the one below you will need to put the mixed-up code in the correct order on the right side. You may need to indent the blocks as well. There may also be extra blocks that are not needed in a correct solution that you can leave on the left side. Click the “Check” button to check your solution.
See the video below for an example.
Try to solve the following mixed-up code problem. This problem doesn’t require any indentation.
Drag the blocks from the left and put them in the correct order on the right. The text in each block defines the order.
Try to solve the following mixed-up code problem. This problem requires indentation.
Drag the blocks from the left and put them in the correct order on the right with the correct indentation. The text in each block defines the order and indentation.
Try to solve the following mixed-up code problem. This problem requires indentation and has extra blocks that are not needed in a correct solution.
Drag the blocks from the left and put them in the correct order on the right with the correct indentation. There is an extra block that is not needed in the correct solution.
The mixed-up code problems have a “Help me” button at the bottom of the problem. Once you have checked at least three incorrect solutions you can click the button for help. It will remove an incorrect code block, if you used one in your solution, or combine two blocks into one if there are more than three blocks left.
See the video below for an example.
21.21.2. Solving Write Code Problems¶
If you see a problem like the one below, you will need to write code. The problem will have unit tests that you can run to check that your code is working correctly. Click on the “Run” button to compile and run your code. Look after the code area for compiler errors and/or unit test results.
See the video below for an example.
Finish writing the code for the following problem.
Write a function called triple(num)
that takes a number num
and
returns the number times 3. For example, triple(2)
should return 6 and
triple(-1)
should return -3. Look below the code to check for any
compiler errors or the results
from the test cases. Be sure to return
the result.
21.21.3. Feedback¶
Please provide feedback here. Please share any comments, problems, or suggestions.
21.21.4. What to do next¶
Click on the following link to go the practice problems: Practice Problems