This commit is contained in:
David Beazley
2020-05-24 19:24:06 -05:00
parent fb834fbaa5
commit 6e07d1c5f5
3 changed files with 52 additions and 54 deletions

View File

@@ -45,22 +45,22 @@ e = 0b10001111 # Binary
Common operations: Common operations:
| | | ```
| ---- | ---- | x + y Add
| + | Add | x - y Subtract
| - | Subtract | x * y Multiply
| * | Multiply | x / y Divide
| / | Divide | x // y Floor Divide
| // | Floor divide | x % y Modulo
| % | Modulo | x ** y Power
| ** | Power | x << n Bit shift left
| << | Bit shift left | x >> n Bit shift right
| >> | Bit shift right | x & y Bit-wise AND
| & | Big-wise AND | x | y Bit-wise OR
| &#124; | Bit-wise OR | x ^ y Bit-wise XOR
| ^ | Bit-wise XOR | ~x Bit-wise NOT
| ~ | Bit-wise NOT | abs(x) Absolute value
| abs(x) | Absolute value | ```
### Comparisons ### Comparisons
@@ -114,16 +114,16 @@ This is **not a Python issue**, but the underlying floating point hardware on th
Common Operations: Common Operations:
| | | ```
| ---- | ---- | x + y Add
| + | Add | x - y Subtract
| - | Subtract | x * y Multiply
| * | Multiply | x / y Divide
| / | Divide | x // y Floor Divide
| // | Floor divide | x % y Modulo
| % | Modulo (remainder) | x ** y Power
| ** | Power | abs(x) Absolute Value
| abs(x) | Absolute value | ```
Theses are the same operators as Integers, except for the bit-wise operators. Theses are the same operators as Integers, except for the bit-wise operators.

View File

@@ -26,15 +26,14 @@ Triple quotes capture all text enclosed in multiple lines.
### String escape codes ### String escape codes
| | | ```
| ---- | ---- | '\n' Line feed
| `'\n'` | Line feed | '\r' Carriage return
| `'\r'` | Carriage return | '\t' Tab
| `'\t'` | Tab | '\'' Literal single quote
| `'\''` | Literal single quote | '\"' Literal double quote
| `'\"'` | Literal double quote | '\\'` Literal backslash
| `'\\'` | Backslash | ```
These codes are inspired by C. These codes are inspired by C.
### String Representation ### String Representation
@@ -118,24 +117,23 @@ t = s.replace('Hello' , 'Hallo')
**More string methods:** **More string methods:**
| | | ```python
| ---- | ---- | s.endswith(suffix) # Check if string ends with suffix
| s.endswith(suffix) | # Check if string ends with suffix | s.find(t) # First occurrence of t in s
| s.find(t) | # First occurrence of t in s | s.index(t) # First occurrence of t in s
| s.index(t) | # First occurrence of t in s | s.isalpha() # Check if characters are alphabetic
| s.isalpha() | # Check if characters are alphabetic | s.isdigit() # Check if characters are numeric
| s.isdigit() | # Check if characters are numeric | s.islower() # Check if characters are lower-case
| s.islower() | # Check if characters are lower-case | s.isupper() # Check if characters are upper-case
| s.isupper() | # Check if characters are upper-case | s.join(slist) # Joins lists using s as delimiter
| s.join(slist) | # Joins lists using s as delimiter | s.lower() # Convert to lower case
| s.lower() | # Convert to lower case | s.replace(old,new) # Replace text
| s.replace(old,new) | # Replace text | s.rfind(t) # Search for t from end of string
| s.rfind(t) | # Search for t from end of string | s.rindex(t) # Search for t from end of string
| s.rindex(t) | # Search for t from end of string | s.split([delim]) # Split string into list of substrings
| s.split([delim]) | # Split string into list of substrings | s.startswith(prefix) # Check if string starts with prefix
| s.startswith(prefix) | # Check if string starts with prefix | s.strip() # Strip leading/trailing space
| s.strip() | # Strip leading/trailing space | s.upper() # Convert to upper case
| s.upper() | # Convert to upper case |
### String Mutability ### String Mutability

View File

@@ -1 +1 @@
theme: jekyll-theme-slate theme: