Hacks Unit 3 Section 3.8.1

  • Define an Iteration an iteration is a loop that goes on and on until a condition is met.

  • Make your own example of an iteration with at least 4 steps and a stopping condition(Similar to mine that I did) An example could be that you do a multiple choice quiz that has unlimited tries and you keep taking the quiz over and over until you get 100%, or at least the score you want.

    1. you take the quiz for the first time
    2. you realize that you get a 70%
    3. you try again
    4. you get an 80%
    5. you try again until you get the score that you want.
  1. Program a simple iteration:
iterable = [1, 2, 3, 4]

for num in iterable:
    print(num)
1
2
3
4

Hacks Unit 3 Section 3.8.2

  • What is an iteration statement, in your own words? An iteration statement is basically a loop that goes on and on until a condition is met
  • Create a descending list of numbers using for loop
iterable = [4, 3, 2, 1]

for num in iterable:
    print(num)
4
3
2
1

Using while loop, make a list of numbers which will form an output of 3,16,29,42,55,68,81

n = 81
i = 3
while i <= n:
    print(i)
    i+=13
3
16
29
42
55
68
81

HACKS Unit 3 Section 10

Part 1

nums = ['38', '45', '67', '83', '78']
minimum = min(nums)
print(min(nums))
38

Part 2

procedures and Procedure calls

  • It takes zero or more arguments
  • The procedures in college board are block statements
  • The return statemen may appear at any point inside the procedure and causes an immediate retrn from the procedure back to the calling statement

Robot

  • It basically gives directions to move left or right. Or rotate it 90 degrees or something like that. Then I think it is kind of like the turtle function where you can actually see a figure moving to those commands

Listing Operations

  • there are several ways that you can list things:
  • [value1, value2, value3]
  • there are a few more ways to do a list but the one above is the most common way to do it.

Relational and Boolean Operators

  • It evaluates true if the condition is false; otherwise evaluates to false
  • Boolean are true and false statements
  • the AND and OR statements compare the two conditions and that is a boolean statement because it is a true or false comparison type of statement.

screenshot