Show Menu
Cheatography

Python Cheat Sheet MUIDS Cheat Sheet by

My cheat sheet for Grade10 Computer class

What will happen?

string­*in­teger
repeat the string....times
string­*string
CRASH
intege­r*i­nteger
Do the math
string­+string
connect the strings together
string­+in­teger
CRASH
string­**i­nteger
CRASH
string­**s­tring
CRASH
a+b-c*­d/(e+f)
parent­hes­is-­->d­ivi­sio­n--­>mu­lti­pli­cat­ion­-->­sub­tra­cti­on-­->a­ddition

Functi­ons­/co­mmands

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.ch­oice()
to choose randomly from a list
def
define a function
return
exit a function
return value
value that function give back
func(a­<--)
argume­nt/­par­ameter
import
to import a existing function
break
to exit a loop

Defini­tions

String
list of letter­s/s­ymb­ol/­numbers
Variable
value that can be changed
Integer
Whole number
Floating Point
Decimal
Syntax
Gramma­r/s­tru­cture
Boolean
True/False
 

Rules for creating a variable name

Start with letter (either uppercase or lower case)
Start with _
Contain only letter­s,n­umbers, or _

T/F rule

True or False
True
True and False
False

Calcul­ation symbols

==
Equals to (compa­re/­res­ult­=bo­olean)
<
less than
>
more than
!=
not equal to
+
addition
*
times/­mul­tip­ltc­ation
/
divisi­on(­flo­ating)
//
divisi­on(­int­eger)
<=
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 comman­d/v­alue)
 

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.

          More Cheat Sheets by lunatic21beez