Show Menu
Cheatography

Python Cheat Sheet MUIDS Cheat Sheet by

My cheat sheet for Grade10 Computer class

What will happen?

stri­ng*­int­eger
repeat the string....times
stri­ng*­str­ing
CRASH
inte­ger­*in­teger
Do the math
stri­ng+­str­ing
connect the strings together
stri­ng+­int­eger
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

prin­t()
print/show info on the screen
int()
convert string to intregers
str()
convert numbers to string
floa­t()
convert integers to decimal
inpu­t()
to gain info from the user
len()
the length of the string
import
to import an external program
rand­om.c­ho­ice()
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
Vari­able
value that can be changed
Inte­ger
Whole number
Floating Point
Decimal
Syntax
Gramma­r/s­tru­cture
Bool­ean
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)

Help Us Go Positive!

We offset our carbon usage with Ecologi. Click the link below to help us!

We offset our carbon footprint via Ecologi
 

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