So, I'm going through the
tutorial and have already found some things that I find interesting.
- Division Operators
- 3//2 = 1 - division that produces an integer by discarding the remainder
- The _ variable will have the last thing printed in the window assigned to it
- A \ at the end of a line will let the string literal span multiple lines
- Indexing of strings
- "someString"[2:7] prints 'meStr'
- "someString"[:3] prints 'som'
- "someString"[-3:] prints 'ing'
- "someString"[:-3] prints 'someStr'
- The built in function len() applies to both strings and lists
Bonus:
- By default the print() function will end with a newline. You can specify a different ending with the keyword end
- Syntax: print(someVariable, end="|")
- The above used in a loop will create a pipe delimited list
No comments:
Post a Comment