All Python From 1 To 23 Flashcards
#
octophorne, pound character used to comment out lines
+
Plus
-
Minus
/
Slash- division
*
Asterisk- multiplication character
%
How does it work
Modulus
X devided by Y with J remaining
The result of % is the J part
Less then
>
Greater than
<=
Less then equal
=>
More then equal
PEMDAS
Parenthesis, Exponents, Multiplication, Division, Addition, Subtraction
X**Y
X to the Y power
A//B
// is used to perform floor division. The expression 100//40 will return the value of 2. Floor division is useful when you need a quotient to be in whole numbers
Variable
A name for memory storages of strings, numbers
Between_ beetwen
Underscore character
=
Assigns value on the right to the variable on the left
==
Tests wether two values are equal
f“text and {some car}”
One way of formatting the string
“Something {} “.formatter(“player”)
Another way to format a string
True “and” False
Python recognises
True and False as keywords representing the concept of true and false
“””something
something”””
Allows you to write every place
\
Backslash- \
\’
Single quote - ‘
\”
Double quote - “
\a
ASCII Bell - makes the sound «dingg»
\b
Backspace - deletes one character behind
\t
Horizontal tab- simple tab
\n
Line feed - simply moves to the next line
\v
Vertical tab
does this thing
\f
Formfeed
does the same thing as\v
\r
Carriage return - e.g
>print(«Fucking\rHell»)
>helling
variable = input()
Takes input from the user and assigns it to the variable
end =‘ ‘
Tell python to not end the line with a newline(\n) character
variable = int(input())
It gets a number as a string than converts it to an integer using int()
Pydoc
Open in terminal, to find answers for your questions
Debugging
Detect and remove errors from…
import
This is how you add modules to your script from the python feature set. Rather than give you all the features at once, Python asks you to say what you plan to use. This keeps your program small
argv
Is a argument variable. This variable holds the arguments you pass to your python script when you run it.
Script, one, two, three = argv
Unpacking the variables