added week 6

This commit is contained in:
left_adjoint 2023-10-31 18:00:11 -07:00
parent 32f510f6b7
commit b660429452
2 changed files with 42 additions and 0 deletions

23
week6/L1agenda.org Normal file
View File

@ -0,0 +1,23 @@
* Agenda
+ Review of lists (they're *not* arrays)
+ Making a list
+ Adding to a list
+ Removing from a list
+ Iterating over lists
+ Review of while loops
+ When to use a while-loop
+ /why not to use While True/
+ Why you should get in the habit of using a main function
+ Even if for your own python scripts you don't actually do it very often
+ Programming time:
+ https://online.pcc.edu/d2l/le/489961/discussions/topics/814822/View
+ Hobbies program
+ Let's program this *together*
+ Tell me what to do
+ Dictionaries review
+ Like lists!
+ But different!
+ Adding functionality to our program
+ Assignment 3
+ What's in it? What do you gotta do?

19
week6/hobbies.py Normal file
View File

@ -0,0 +1,19 @@
# my own example of the hobbies discussion prompt
# we need to write a main function in order to
def main():
# boolean variable to control
toContinue = True
hobbies = []
while toContinue:
hobby = input("Enter one of your hobbies: ")
if hobby.lower() == "quit":
toContinue = False
print("Your hobbies were: ")
for h in hobbies:
print(h)
else:
hobbies.append(hobby)
main()