Cheatography
https://cheatography.com
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_number |
'' |
while user_number ! |
' 0 ' : |
user_number |
input ("Enter a number to convert to binary") |
number |
int(user_number) |
binary_string |
' ' |
while (number > 0): |
remainder |
number%2 |
binary_string |
str(remainder)+ binary_string |
number |
number//2 |
print ("Binary string) |
is", binary_string |
|
|
Reverse Word
word |
input("Please enter a word") |
index |
0 |
reverse = |
' ' |
while int(index) |
< len(word): |
reverse |
word[index] + (reverse) |
index |
int(index) + 1 |
print |
("Reverse: ", reverse) |
Function
print() |
Show information that you want on the screen |
int() |
Change number to be number integer |
float() |
Change number to be decimal number |
input() |
Gain information from user |
str() |
A list of number, letter and symbols |
len() |
The length of the string |
# |
Comment, no effect |
|
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment