Changes between Version 57 and Version 58 of ControlSystems/SoftwareTeam/IntroToPython
- Timestamp:
- Sep 4, 2017, 7:46:19 PM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ControlSystems/SoftwareTeam/IntroToPython
v57 v58 207 207 * `sum(iterable)`: Sums all the numbers in the list ''iterable''. 208 208 * `<string>.isdigit()`: Strings and some other variable types like lists have some special functions just for them, called methods. This one returns true of all of the digits in the string are numbers, others are [[https://docs.python.org/3/library/stdtypes.html#string-methods|here]]. '123' would return ''True'', "Cat" would return ''False''. Handy for validation. You call them *on* the variable itself, and it has to have a value before you can call these methods. 209 * 'int(string)': Converts an string to a number (so you can do things like math on it).209 * `int(string)`: Converts an string to a number (so you can do things like math on it). 210 210 211 211 Here's some examples of how they're used (don't forget to look at earlier lessons for range() and print().