Pseudo Code Notes
First thoughts
- Pseudo code is very readable
- The arrows kind of throw me off when assigning variables
- I really like the blocks that separate the code segments
Usage
- Assing variables values using arrows
- Loops use “Repeat Until”
- If and if else statements are the same as python
- MOD is modulo and returns the remainder when dividing two numbers
Example 1
- Program A and B are the same except for the order that the function body occurs in.
- Program A displays i before it prints it
- Program B displays i after it prints it
Example 2
- The random(1, 6) is like the random module in python
- it uses two if statements for the two possibilities for yellow and blue, but every other possibility is red
Example 3
- This answer is pretty intuitive
- You start at the first circle at (3,6).
- You use a repeat 3 times that will draw the circle with a radius of two and then add 2 to the x position and subtract 2 from the y position.
Example 4
- Its important to look at the last if statement to check if the movie is in 3D. It simply checks if its True or False and will add 5 to the ticket price if it is
- Now lets look at the
Example 5
- I was pretty confused on this question, particularly for the return section
- After reviewing, it is returning a statement that is comparing itself only if it is true. So if counter is greater than half of the total, then return it, but if not, then dont.
Example 6
- This question seems time-consuming and complicated, but you need to start from the end and go backwards
- If you check how it ends, includes can either be true or false so there has to be in an or statement in the answer
Example 7
- The main focus of this question is the MOD
- MOD means modulo which will return the remainder of the divison of two numbers
- So if they’re trying to calculate every 10th purchase, use modulo because if the purcahse is the 10th, it will return a remainder of 0 when divided by 10
Example 8
- This question was kind of tedious
- It was more of a guess and check
- I took two numbers, 50 and 35, and ran through every answer. Answer C was the most reasonable