Week 02 lab book
- Working though Codecademy has been useful for practicing syntax and learning actual code, rather than code concepts. Code concepts are more useful in general but eventually you need to know the specifics to do something.
- Testing as an idea: write tests that fail, tests that only just passes, test in a way that is tidy and repeatable.
- Abstraction: once something is defined, you don’t need to define it every time you want to refer to it.
- Challenging but rewarding exercises to work through this week. It was very satisfying to solve them, working through guesses and logic of previous exercises that worked.
More terminal codes
- ctrl + L : clear the terminal window
- ls -a : list directory and shows hidden files
- cd .. : change up one directory
- cd ../../ : change up two directories
- alt + F3 : select all that match
- shift + alt + arrow down : select at a point down multiple lines
- hold shift + click : place cursors at multiple points
- ctrl + shift + b : run code in editor
- # comment
- x**y : exponent, x to the power of y
- “string”.upper() : uppercase
- “string”.lower() : lowercase
- + : concatenate strings
Python lists modifiers
- list.append() : add to end of list
- list[index].insert() : insert into list at index
- list.index(“string”) : return index of string
- list.sort() : sort list
- list.remove() : remove item
- Why does tests.py only run when in the codebase1161 folder and using the code:
>> ~ python week2/tests.py
I would have thought this would work too:
>> week2 ~ python tests.py