-
Notifications
You must be signed in to change notification settings - Fork 0
/
Part1_Numbers.py
59 lines (42 loc) · 1.29 KB
/
Part1_Numbers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#####################################
#### Numbers and more in Python! ####
#####################################
# Types of numbers
#
# Python has various "types" of numbers (numeric literals). We'll mainly focus on
# integers and floating point numbers.
#
# Integers are just whole numbers, positive or negative.
#
# Floating point numbers in Python either have a decimal point
# in them, or use an exponential (e) to define the number. For example 1.0 and -1.1
# are examples of floating point numbers. 4E2 (4 times 10 to the power of 2) is
# also an example of a floating point number in Python.
#
# Basic Arithmetic
# Addition
print(2+1)
# Subtraction
print(2-1)
# Multiplication
print(2*2)
# Division
print(3/2)
# Powers
print(2**3)
# Can also do roots this way
print(4**0.5)
## Variable Assignments
# You also don't need to specify the keyword var while declaring variables
# The names you use when creating these labels need to follow a few rules:
#
# 1. Names can not start with a number.
# 2. There can be no spaces in the name, use _ instead.
# 3. Can't use any of these symbols :'",<>/?|\()!@#$%^&*~-+
# 3. It's considered best practice (PEP8) that the names are lowercase.
#
my_income = 100
tax_rate = 0.1
my_taxes = my_income*tax_rate
# Show my taxes!
print(my_taxes)