ohmmm Cheat Sheet

A cheat sheet in English by ohmphuchong
1,700 views 718 downloads 12 Feb 2016 History
3.7 avg · 0 ratings

Math

==
equal to
!=
no equal to
<
less than
>
more than
<=
less than or equal to
>=
more than or equal to
%
Modulo, Find the remainder

Addition

string + string
combine together
string + number
CRASH
number + number
Addition Math

Convert to binary

user_n­­umber
'­'
while user_n­­umber !
' 0 ' :
user_n­­umber
input ("Enter a number to convert to binary­­")
number
int(us­­er­_­n­umber)
binary­­_s­tring
' '
while (number > 0):
remainder
number%2
binary­­_s­tring
str(re­­ma­i­n­der)+ binary­­_s­tring
number
number//2
print ("Binary string)
is", binary­­_s­t­ring

Reverse Word

word
input(­­"­P­lease enter a word")
index
0
reverse =
' '
while int(index)
< len(word):
reverse
word[i­­ndex] + (reverse)
index
int(index) + 1
print
("Re­­verse: ", reverse)

Function

print()
Show inform­­­ation that you want on the screen
int()
Change number to be number integer
float()
Change number to be decimal number
input()
Gain inform­­­ation from user
str()
A list of number, letter and symbols
len()
The length of the string
#
Comment, no effect

Comments

No comments yet.

Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.