You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by jdonwells March 16, 2022
4.04 goes through nested loops and lists a second time for 2 days. 4.03 also covers nested loops. 4.05 covers debugging nested loops. All together that is 5 days. Nested loops don't deserve that much attention in my opinion.
I moved the Tic-Tac-Toe game to Unit 3 because it doesn't need loops and it certainly doesn't need nested loops. #358 If the motivation behind 5 days of nested loops is Tic-Tac-Toe then it isn't required.
Instead I have proposed a change to 4.03 making a one day lecture and lab on nested loops and nested lists. #367
I would now like to propose changing lesson 4.04 to cover list comprehensions. List comprehensions are a vital piece of Python that we don't seem to cover.
The goal of this lab is to practice using list comprehensions. Add a list comprehension to the starter code.
The functionmultiply_list(numbers, multiplier) will return a new list where each number in the numbers list will be multiplied by multiplier.
Starter Code
numbers=list(range(1,11)) # 1 to 10defmultiply_list(numbers, multiplier):
return[] # <-- put a list comprehension hereprint(numbers)
print(multiply_list(numbers, 3))
Discussed in #370
Originally posted by jdonwells March 16, 2022
4.04 goes through nested loops and lists a second time for 2 days. 4.03 also covers nested loops. 4.05 covers debugging nested loops. All together that is 5 days. Nested loops don't deserve that much attention in my opinion.
I moved the Tic-Tac-Toe game to Unit 3 because it doesn't need loops and it certainly doesn't need nested loops. #358 If the motivation behind 5 days of nested loops is Tic-Tac-Toe then it isn't required.
Instead I have proposed a change to 4.03 making a one day lecture and lab on nested loops and nested lists. #367
I would now like to propose changing lesson 4.04 to cover list comprehensions. List comprehensions are a vital piece of Python that we don't seem to cover.
Here is my slide show. https://docs.google.com/presentation/d/1pZHqtiT0GV-h5TIXybDXklweRxKqLloQNCTFoiOF_C8/edit?usp=sharing You may notice it references changes I made to 4.02. #365
Assignment looks like this:
Lab 4.04 - List Comprehension
Part 1
The goal of this lab is to practice using list comprehensions. Add a list comprehension to the starter code.
The function
multiply_list(numbers, multiplier)
will return a new list where each number in thenumbers
list will be multiplied bymultiplier
.Starter Code
The output should look like this:
The text was updated successfully, but these errors were encountered: