Cheatography
https://cheatography.com
Function
input() |
Ask for information from user. |
print() |
Show information that we want on the scree. |
int() |
Change number to be number integer. |
float() |
Change number to be decimal. |
str() |
String. A list of number, letter, and symbol. |
Math
== |
equal to |
!= |
not equal to |
< |
less than |
> |
more than |
<= |
less than or equal to |
>= |
more than or equal to |
mylist
mylist = range(5)
mylist = [0, 1, 2, 3, 4]
|
|
Addition
Str + Str |
Combine together. Like "1" + "2" = 12 |
Str + number |
Crash |
Number + Number |
Sum, addition |
Subtraction
str - number |
crash |
str - str |
crash |
number - number |
Subtract |
Division
str / str |
crash |
str / number |
crash |
number / number |
division |
Multiplication
str * number |
combine that string. "6" * 2 = '66' |
str * str |
crash |
number * number |
multiply |
str ** str |
crash |
number ** number |
exponent, power |
str ** number |
crash |
|
|
Vocab
Variable |
Something that can change |
String |
a list of character like number, letter and symbols. |
Integer Number |
Whole number or Counting number |
Float Number |
The number into decimal number |
Syntax |
Structure of language |
Loop |
while |
Input |
Gain information from user |
Print |
Show information that we want on the screen. |
Random
random.choice() |
random word in the list. need to put 'import random' at the top first. |
True and False
y = true
print (not y or 2<3)
not true or 2<3
False or True
True
True or anything == True
False or anything == False
|
Created By
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment