100 days of code: Day 4 - numbers

Last modified on 2020-06-12

Source: 100-days-of-code.

Python and integers, floats, and arithmetic operations. Here is a short program - eight.py - that performs addition, subtraction, multiplication, division, and exponent operations to produce the number 8 …

NUMBER = 8      # capitalize variables that should remain constant
v, w, x, y, z = 0, 0, 0, 0, 0   # multiple assignment of values to variables

print(NUMBER)
v = 7 + 1
print(v)
w = 1_000_000 - 999_992
print(w)
x = 2 * 4
print(x)
y = 64 / 8
print(y)
z = 2 ** 3
print(z)
# print a penguin because why not?
print('\n(O<')
print('(/)_')

… output ….

$ python3 eight.py 
8
8
8
8
8.0
8

(O<
(/)_

Happy hacking!