First, the four basic arithmetic operators
1 plus +
print(3 + 2)
Save 2 -
print(3-2)
3 by: *
print(3 * 2)
In addition to 4 /, //
print(3 / 2)
print(3 // 2)
5 operators, operands
Exercise:
print(3 + 2)
print(3 – 2)
print(3 * 2)
print(3 / 2)
print(3 // 2)
Second, the sequence of operations
First multiplication and division, then addition and subtraction, parentheses are calculated first brackets
print(3+5*3)
print(155 – 3*5 + 44/4)
Three, the other four operators:
1, the index: **
Squaring a power, how much power a number of
3*3*3*3*3
3 of 5 power
print(3 ** 5)
print(4 ** 5)
print(10 ** 2)
print(10 ** 3)
print(10 ** 4)
print(10 ** 5)
print(3.2 * 10 ** 5)
2, modulo:%
print(7%2)
3, the self-energizing + =
score = score + 1
score += 1
4, since the reduction - =
score = score – 1
score –= score
Exercise:
print(3*3*3*3*3)
print(3**5)
score = 5
score-=1
print(score)
Four, very Yamato very small
Not represented in the computer, e notation:
3.8e16