Cheatography
https://cheatography.com
VOCABULARY
blank |
empty |
float |
the number in decimal |
input |
information that is put in it |
integer |
whole number or counting |
loop |
goes on (again and again) |
number |
number |
print |
to show information |
string |
a list of character such as number, letter and symbols |
syntax |
grammar or structure of lauguage |
value |
the amount of something |
variable |
hold a value and can be change |
|
|
EXAMPLES
print ("" + "1" + "2") |
12 |
print (int(2.5)) |
2 |
print (float(2.5)) |
2.5 |
print (float(int(2.5))) |
2.0 |
number1 = 11 number2 = 22 sum = str(number1) + str(number2) print(sum) |
1122 |
number1 = "11" number2 = "22" sum = int(number1) + float(number2) print(sum) |
33.0 |
bacon = "keep calm and eat bacon" letter = bacon[5] print (letter) |
c |
index = 0 index = index + 1 index = index + 2 text = "coke zero is the best" print (text[index]) |
e |
index = 2 index = index * 5 text = "coke zero is the best" print (text[index]) |
i |
myboolean = 2 != 3 if myboolean: print ("truth") else: print ("lies") |
truth |
myboolean = 2 == 3 if myboolean: print ("truth") else: print ("lies") |
lies |
boolean1 = 2 <= 3 boolean2 = 2 >= 3 if boolean1 == boolean2: print (1) else: print (3) |
3 |
boolean1 = 2 <= 3 boolean2 = 2 >= 3 if boolean1 == boolean2: print (1) elif boolean1 != boolean2: print (2) else: print (3) |
2 |
index = 0 while index < 4: index = index + 4 print (index) |
4 |
hello = "hello there!" out = "" for letter in hello: out = letter |
! |
print(out) hello = "hello there!" out = "" for letter in hello: out = letter + out |
!ereht olleh |
|
|
MATH
== |
equal to |
!= |
not equal to |
< |
less than |
> |
more than |
<= |
less than or equal |
>= |
more than or equal |
% |
Modulo, find the remainder Vocabulary variable Hold a value and can be changed syntax Grammar or structure of language modulo Find the remainder boolean True or false floating point The number in decimal |
|
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment