Numeric operation
- When integers are divided, integer division is used, discarding the fractional part. When at least one of the input numbers is floating point, floating division is done preserving the factional part.
- The print operation automatically adds spaces between the items which is prints, and places a newline at the end.
- The multiple assignment computes all values on the right before assigning anything, an extension of the usual rules for a single assignment.
- Lines to be continued by putting a backslash at the end of the first part or the line break in contained in a grouping pair.
About Strings
- Quotes are used for create strings.
- Triple quotes create multi-line strings.
- String literals may be concatinated by a space.
- Any string expression may be concatinated by a + (Java style).
- String length can be obtained by function len(string)
- String with backslash can be combined for different escapes, like '\n' is new line.
- Raw string starts with r.
String operations
- String can be treated as an array with characters and index starts with 0.
- Use brackets to extract substrings, like string[1], string[0:5], string[:5], string[8:].
- The last character is not part of the range.
- The '*' operator repeats strings.
- Negatives index back from the right.
About List
- List is defined within a bracket and separated with coma.
- List also can be extracted by using the same way as presenting the string characters. The ranges can be called as 'slice'.
- Individual items in the list can be replaced. Slice also can be replaced and size of list can be changed due to the replacement.
- Sublist is allowed, which means lists in a list.