Cheatography
https://cheatography.com
vocaburary
variable |
holds a value and can be changed |
string |
a list of characters such as numbers, letters, symbols |
comment |
The pieces of program text which are ignored by Python are called comments. |
float |
The type used to represent numbers with a fractional part. |
Multiplication and Exponents
string * number |
combine that string multiple times |
string * string |
crash |
number * number |
math - multiply |
string ** number |
crash |
|
|
symbol
= |
assigns the value on the right to a variable on the left |
== |
Tests if two things have the same value |
""" |
quotes out everything beneath/after these triple quotes until it reaches another triple quotes |
code
print (name.upper()) |
print (name.lower()) |
print (name.capitalize()) |
print (name.title()) |
Addition
string + string |
combine together |
string + number |
crash |
number + number |
math - addition |
|
|
data type
true |
True boolean value. |
True or False == True |
false |
False boolean value. |
False and True == False |
non |
Represents "nothing" or "no value". |
x = None |
string |
Stores textual information. |
x = "hello" |
number |
Stores integers. |
i = 100 |
floats |
Stores decimals. |
i = 10.389 |
lists |
Stores a list of things. |
j = [1,2,3,4] |
dicts |
Stores a key=value mapping of things. |
e = {'x': 1, 'y': 2} |
function
print() |
displays information on the screen |
input() |
receives information from the user |
int() |
converts a value to an integer |
|
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment