“There is no failure, only trying.”
Ok Let’s try to make a list of symbols, see how well I understand and recall their functions. It’s going to be tedious but the end goal is to create a reference table with my own words, which can help me review in the long term.
# | Hash, Mesh or octothorpe | To comment out a piece of code, or make a note for future reference |
Show a statement or string on the screen | ||
‘’ | Single quote | For short string |
“” | Double quote | For longer string |
“”” “”” | Triple quote | For paragraph |
variable | A value container, we store data in them | |
(f”) | String format | A convenient way to write string with variable in a print functionEx: print(f”If I add {age}, {weight}, and {height} I get {total}.”) |
.format() | Single Format | Format a specified value and insert them inside the string’s placeholderEx:hilarious = False (A boolean value)joke_evaluation = “Isn’t that joke so funny?! {}“print(joke_evaluation.format(hilarious)) |
\n | Line break escape | To put a linebreak between lines in a string |
\t | Tabbing escape | To indent a string |
\split | Splitting escape | To split a string |
\\ | Double backlash escape | To print out a backlash in a string |
input() | Input method | To prompt user to input value |
int() | Integer converter method | To convert a string to integer value for mathematical usages |
argv | Argument Variable | To capture variable, unpack and assign values by the user to the variable names assigned to ARGV |
open() | Open method | To take filename & return file object |
read() | Read method | To access file object & return content |
close() | Close method | To close the opened file |
open(filename, ‘w’ | ‘w’ = write only mode | Write or overwrite content of an existing file (it will automatically truncate content first) |
.truncate() | Truncate | To wipe out content in an existing file object |
.write | Write | To write content in a file |
exists | Exist | To check file’s availability in boolean format |
len() | Length | To return the length of the string |
def | keyword | To denote a method’s definition |
+= | Positive increment | Add to existing variable value. (variable += 1 is the same as variable = variable + 1 ) |
return | Return statement | To send the function’s result back to the caller. |
.seek | Look method | To find a specific place by byte in the file’s contentsEX.seek(0): get to the first character of the string |