Changes between Version 37 and Version 38 of ControlSystems/SoftwareTeam/IntroToPython
- Timestamp:
- Sep 4, 2017, 6:48:24 PM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ControlSystems/SoftwareTeam/IntroToPython
v37 v38 184 184 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="")`''. '' 185 185 1. An empty print statement `print("")` just prints a new line. 186 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.]186 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.] 187 187 188 Answer is [wiki:ProgrammingAnswerPotatoExercise here].188 The answer is [wiki:ProgrammingAnswerPotatoExercise here] . 189 189 190 190 [[[wiki:ProgrammingReserve Programming]Archive | Programming Archive]]