What it does: allows you to comment on the code, anything after the # is ignored by python
What it does: addition
What it does: subtraction
What it does: division
What it does: multiplication
What it does: for math, it is the remainder of the division
What it does: Finds whether true or false whether X is less-than Y
What it does: Finds whether true or false whether X is greater-than Y
What it does: Finds whether true or false whether X is less-than or equal-to Y
What it does: Finds whether true or false whether X is greater-than or equal-to Y
What it does: assigns value on the right to a variable on the left. Variables need to start with a character (not a number)
What it does: tests if two things have the same value
"string %s" % variable
Name: format string
What it does: embed variables in a string using specialized format sequences, and putting variables at end with special syntax. If you want multiple formats in your string to print multiple variables, you need to put them inside a ( ) (parenthesis) separated by , (commas).
Name: s formatter
What it does: displays variables for users
Name: round function/command
What it does: rounds numbers
What it does: putting two single-quotes around text creates a string
What it does: putting two double-quotes around text creates a string
Name: r formatter
What it does: for debugging, displays the "raw" data of the variable. Also known as the "representation"
Name: d formatter
What it does: displays variables in decimal numery system for users
""" or '''
Name: triple double- or single-quotes
What it does: allows you to create a string that only ends when you put another tripe double- or single- quote
What it does: An escape sequence that inserts a backslash in a string
Name: single quote (')
What it does: An escape sequence that inserts a single quote in a string
Name: Double quote (")
What it does: An escape sequence that inserts a double quote in a string
Name: ASCII Bell (BEL)
What it does: An escape sequence that inserts a beep noise in a string
Name: ASCII Backspace (BS)
What it does: An escape sequence that inserts a backspace in a string
Name: ASCII Formfeed (FF)
What it does: An escape sequence that inserts a new page for a printer (and ejects current page) in a string ???
Name: Linefeed (LF)
What it does: An escape sequence that inserts a new line in a string
Name: Character named name in the Unicode database (Unicode only)
What it does: An escape sequence that ???
Name: Carriage Return (CR)
What it does: An escape sequence that inserts a return in the string
Name: Horizontal Tab (TAB)
What it does: An escape sequence that inserts a horizontal tab in the string
Name: Character with 16-bit hex value xxxx (Unicode only)
What it does: An escape sequence that ??? in the string
Name: Character with 32-bit hex value xxxx (Unicode only)
What it does: An escape sequence that ??? in the string
Name: ASCII Vertical Tab (VT)
What it does: An escape sequence that inserts a vertical tab in the string
Name: Character with octal value ooo
What it does: An escape sequence that inserts a character with octal value ooo in the script
Name: Character with hex value hh
What it does: An escape sequence that inserts a character with hex value hh in the script
What it does: if inside a script, makes sure the print command doesn't end the line with a newline and go to the next one
Name: raw input command
What it does: allows you to input a string into the script/code. You can also put a prompt within the parenthesis to show a person so they know what to type.
Name: integer command
What it does: converts user input into an integer
Name: input command
What it does: convert things you enter as if they were Python code, but has security problems so you should avoid it
python -m pydoc x
Name: pydoc command
What it does: Python gives information on x
from sys import argv
Name: script that accepts arguments
What it does: pass arguments as variables into script. Import allows you to add modules to your script from the Python feature set.
Name: import command
What it does: adds modules to your script from the Python feature set
Name: argument variable
What it does: allows variables to hold arguments you pass to Python script when you run it. "Unpack" assigned variables to the left of the = argv in order. The user is required to give input arguments
Name: sys module
What it does: It is a "package" ???
Name: open command
What it does: opens the file for commands that you can give it. Without parameter the command opens file in 'r' (read) mode. The "w" parameter (filename, 'w') opens file in writing mode, and the 'a' paramter opens file in append mode. The + modifier expand the file modes: 'w+', 'r+', and 'a+' opens file in both read and write mode, and depending on character positions the file in different ways.
Name: read command
What it does: allows user to read file
Name: dot or period
What it does: you give a file a command by using the period after the file, the name of the command, and the parameters of the command
Name: close command
What it does: closes the opened file
Name: reads line command
What it does: reads just one line of a text file given parameters. Inside the command is code that scans each byte of a file until it finds a \n character, then stops reading the file to return what it found so far. The file in the parenthesis is responsible for maintaining the current position in the file after each readline() command.
Name: truncate command
What it does: empties the file
Name: write command
What it does: writes stuff in parenthesis into file
from os.path import exists
What it does: imports the exists command from the os.path package
Name: exists command
What it does: Based on the file's name in a string as an argument, the exists command returns True if a file exists and False if not.
Name: length command
What it does: gets the length of the string that you pass to it then returns that as a number
What it does: Create functions by using def (define). We run/use/call functions. Function names cannot start with numbers. Functions do three things. 1) Name pieces of code the way variables name strings and numbers. 2) Take arguments the way your scripts take argv. 3) Allows you to make your own "mini scripts" or "tiny commands". The lines after the first in the function script must be indented 4 spaces. To end the function script you must "dedent". Use *args (asterisk args) in the parenthesis to have same use as the argv parameter but for functions. Must end the def line with a colon, and then indent. The variables in functions are not connected to variables in the script.
Name: seek command
What it does: Files in Python has a "read head", and you can "seek" this read head around the file to different positions. Each time you do seek(0), you're moving to the start of the file. The seek command is dealing in bytes (not lines). The 0 byte is the first byte in the file.
Name: plus minus
What it does: contraction for two operations = and +. x = x + y is the same as x += y.
What it does: allows variables to be a value from a function