Notes:

  • Express an algorithm that uses iteration without using a programming language
  • Determine the result or side effect of iteration statements
  • Write iteration statement Lesson Objectives:
  • Express an algorithm that uses iteration without using a programming language
  • Define an iteration
  • The Basics Of Iteration
  • Examples
  1. Define an Iteration
    • iteration is a repetition of a process
  2. Make your own example of an iteration with at least 4 steps and a stopping condition(Similar to mine that I did)
    • Lose keys
    • search the last place you saw it
    • if not found, search the other last place you saw it
    • if not found, give up
    • if found, enjoy your keys
  3. Program a simple iteration.
room = ["cat", "tomb", "mom","dog"]
for i in room:
    if i == "dog":
        print("this is dog")
        break
    else:
        print(i, " is not dog")
cat  is not dog
tomb  is not dog
mom  is not dog
this is dog
  1. What is an iteration statement, in your own words?
    • when the same procedure is repeated multiple times
  2. Create a descending list of numbers using for loop
    • below
  3. Using while loop, make a list of numbers which will form an output of 3,16,29,42,55,68,81
    • below
for i in range(10, 0, -1):
    print(i)
10
9
8
7
6
5
4
3
2
1
i=3
while i<=100:
	print(i)
	i=i+13
3
16
29
42
55
68
81
94
  • Use the list made bellow
  • Make a variable to hold the minimum and set it to potential minimum value
  • Loop
  • Check each element to see if it is less than the minimum variable
  • If the element is less than the minimum variable, update the minimum
  • After all the elements of the list have been checked, display the minimum value
nums=["10", "15", "20", "25", "30", "35"]
min = min(nums)
add = input()
add_list = nums.append(nums)  # type: ignore
print(add_list)

if the picture dosnt work:

What returns the number of elements currently in a specific list?
length()
Correct!
What allows a value to be added at the end of a list?
append()
Correct!
What allows an element at index i to be deleted from a list?
remove()
Correct!
What allows a value to be inserted into a list at index i?
index()
Correct!
100.00%
Your total score is:  4 out of 4. Not too bad, keep on studying!