19 | | * ''Functions'': These do things. They take nouns as arguments, do something, and can return nouns. In `redCar = paintCarRed(blueCar)`, `paintCarRed` is a function. They're the verbs, they do things, and they take variables and return variables. Some functions are built in to Python, but you can create your own. |
| 19 | * ''Functions'': These do things. They take nouns as arguments, do something, and can return nouns. In `redCar = paintCarRed(blueCar)`, `paintCarRed` is a function. They're the verbs, they do things, and they take variables and return variables. Some functions are built in to Python, but you can create your own. |
185 | | 1. You can tell a print to not end with a new line by adding an end="" to the print statement, like `print("Im a teapot!",end="")`''. '' |
186 | | 1. An empty print statement `print("")` just prints a new line. |
187 | | 1. If you want to loop over a set of numbers, use a `range()`. For example, `for x in range(0,5)` will make x go from 0 to 4 incrementing 1 each time it loops. The first number is where you start, and the second number is where you want to stop __minus 1__. Don't ask why. Its really nerdy. Not buying it? Fine. [https://softwareengineering.stackexchange.com/questions/110804/why-are-zero-based-arrays-the-norm Don't say I didn't warn you.] |
| 185 | 1. You can tell a print to not end with a new line by adding an end="" to the print statement, like this `print("Im a teapot!",end="")`''. '' |
| 186 | 1. An empty print statement `print("")` just prints a new line, basically wrapping any line you're on. |
| 187 | 1. If you want to loop over a set of numbers, use a `range()`. For example, `for x in range(0,5)` will make x go from 0 to 4 incrementing 1 each time it loops. The first number is where x starts, and the second number is where x will stop __minus 1__. Don't ask why---its just the way computers and programs work. Don't believe me? Fine. [https://softwareengineering.stackexchange.com/questions/110804/why-are-zero-based-arrays-the-norm Don't say I didn't warn you.] |