t4
t4
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
- Define an Iteration
- iteration is a repetition of a process
- 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
- 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")
- What is an iteration statement, in your own words?
- when the same procedure is repeated multiple times
- Create a descending list of numbers using for loop
- below
- 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)
i=3
while i<=100:
print(i)
i=i+13
- 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!