Pseudo Code Notes

First thoughts

  • Pseudo code is easy to read.
  • Arrows for variable assignment can be confusing.
  • I like the clear code separation with blocks.

Usage

  • Use arrows to assign values to variables.
  • Loops use “Repeat Until.”
  • If and if-else statements are similar to Python.
  • MOD means finding the remainder when dividing two numbers.

Problem 1

  • Programs A and B are almost the same.
    • Program A shows “i” before printing.
    • Program B shows “i” after printing.

Problem 2

  • “random(1, 6)” is like Python’s random module.
  • Yellow and blue have separate if statements; everything else is red.

Problem 3

  • This solution is straightforward.
    • Start at (3, 6) and draw circles three times, moving by 2 in x and y.

Problem 4

  • Check the last if statement to see if the movie is in 3D.
  • If it’s True, add 5 to the ticket price.

Problem 5

  • Initially confusing, especially the return section.
  • If the counter is over half the total, return it; otherwise, don’t.

Problem 6

  • Seems complex, but work backward from the end.
  • Use “or” because “includes” can be true or false.