Show Menu
Cheatography

python_1 Cheat Sheet by

basic

variable :
comment :
intege­rs/­floats = numbers
single = #comment
string­s/text = characters
multi = "­"­"­com­men­t"""
boolean = true/false

basic_2

+ addition
output : print()
- subtra­ction
assigning strings : using "..."­
* multip­lic­ation
string placement : 1st letter = 0
/ division
print multiple variables : using comma
** to the power of
length : how many symbols are used ex. len(cat)
% modulo
blank space counts as a character
 
ex : dog = "­small puppy"
 
print (len(dog))
len can't use toward number because it is for string only

string method ;

upper = capital letter ; upper()
ex. print (cat.u­pper())
lower = small letter ; lower()
ex. print (cat.l­ower())
str = make into string
ex. x = 47
y = str(x)
dot notation can use only string
 

concat­enation

concat­enation = joining multiple strings together
ex. phrase = "­Tas­k" + "­is" + "­bal­din­g"
print (phrase)
output = Taskis­Balding
!!!!No­te!!! gaps/s­paces
phrase = "Task " + "is " + "­bal­din­g"
print (phrase)
output = Task is Balding

function

int() change number into integer
float() change number into decimal
input() ask for inform­ation from user
str() A list of number, letter and symbols

operation

== equal to
!= no equal to
< less than
> more than
<= less than equal
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.