Please enable JavaScript.
Coggle requires JavaScript to display documents.
Three Structures, *use brackets () to indicate the order of preference,…
Three Structures
-
- Repetition/loop Structure
- Decision Structure
If condition is true... else...
*use brackets () to indicate the order of preference, orelse
-
-
-
- Multiplication, division,
-
-
Arithmetic Operators
Division
/
- even when divisable, ans will be a float
e.g. 6/2 = 3.0 (with dp = float)
-
-
-
-
-
-
-
-
-
-
-
ceil and floor
ceil
help(math.ceil)
input: ceil(x,/)
input: ceil(3.00001,/) =finding the smallest int satisfies x>3.00001
output = 4
floor
help(math.floor)
input: floor(x,/)
input: floor(3.00001,/) = finding the largest int satisfies x<3.0001
output = 3
FUNCTION
Print function
print("XX")
" "入面的打返出黎 (XX)
*use , to separate items
iprint("CityU", 1984)
output = CityU 1984
Documentation
begin with a # hashtag
The things after the # will be displayed in red and Python will skip the red part when
running the program.
-
-
random module
import random
help(random.randint)
input: random.randint(a,b)
-
input: random.uniform(a,b)
-
-
-
-
-
-
-
-
-
-