Week 0
Functions and variables
A program can ask a person something, remember the answer, and hand a result back.
A function is a named recipe. You can hand it ingredients, called arguments. It can hand a value back, which is a return, or it can just do something you can see, such as print. Those are different. Printing shows a line on the screen. Returning gives a value to whoever called the function, and nothing appears unless someone prints it.
A variable is a name stuck on a value. Text is a str. A whole number is an int. A number with a decimal point is a float. The same word can mean different things if it lives inside a function: that is scope. A bug is the program doing something other than what you meant. Read the line Python points at, then the line just above it.
A fresh example, not a problem: a function that takes a temperature in Celsius and returns Fahrenheit. You pass in 0, you get 32 back. You have not printed anything until you ask to. Try that in the Python prompt before you open a problem.
Problems
- Indoor VoiceA change that applies to the whole line of text.
- Playback SpeedFind the gaps between words and replace each gap.
- Making FacesSwap a few typed marks for a picture, and leave the rest of the line alone.
- EinsteinA formula that turns a mass into an energy.
- Tip CalculatorTwo small conversions the spec left blank. The conversation around them is already written.