Cheatography
https://cheatography.com
What will happen?
string*integer |
repeat the string(integer)times |
string*string |
CRASH |
integer*integer |
Do the math |
string+string |
connect the strings together |
string+integer |
CRASH |
string**integer |
CRASH |
string**string |
CRASH |
a+b-c*d/(e+f) |
parenthesis-->division-->multiplication-->subtraction-->addition |
Functions/commands
print() |
print/show info on the screen |
int() |
convert string to intregers |
str() |
convert numbers to string |
float() |
convert integers to decimal |
input() |
to gain info from the user |
len() |
the length of the string |
import |
to import an external program |
random.choice() |
to choose randomly from a list |
def |
define a function |
return |
exit a function |
return value |
value that function give back |
func(a<--) |
argument/parameter |
import |
to import a existing function |
break |
to exit a loop |
continue |
to continue the loop |
|
|
Rules for creating a variable name
Start with letter (either uppercase or lower case) |
Start with _ |
Contain only letters,numbers, or _ |
T/F rule
True or False |
True |
True and False |
False |
Definitions
String |
list of letters/symbol/numbers |
Variable |
value that can be changed |
Integer |
Whole number |
Floating Point |
Decimal |
Syntax |
Grammar/structure |
Boolean |
True/False |
Calculation symbols
== |
Equals to (compare/result=boolean) |
< |
less than |
> |
more than |
!= |
not equal to |
+ |
addition |
* |
times/multipltcation |
/ |
division(floating) |
// |
division(integer) |
<= |
less than or equal to |
>= |
more than or equal to |
** |
exponents (to the power of...) |
%__ |
Modulo (Find the remainder from dividing with __) |
= |
equals to (give command/value) |
|
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
More Cheat Sheets by lunatic21beez