-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathnumbers.py
82 lines (60 loc) · 1.37 KB
/
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 16 00:17:22 2021
@author: mjach
"""
'''
python has three types of number int, Float, and complex
In python integer and other data types are objects. By saying that means
we can create new one by calling methods.
'''
'''Integer number '''
#these are all integer number
a = 12
b = - 1000
c = 0
'''Float numbers'''
#these are all float numbers
a = 7.0
b = -17.3
c = 0.
''' Complex number '''
#these are all complex number
a = 22j
#Integer and float number can be added togather and
# result will be float
#Example
a = 5.0 #float number
b = 2 # integer number
c = a + b
print('C=',c) # result will be float
'''
Boolean types
'''
# in python boolean are also a number. boolean types are True or Flase
# True is 1
# Flase is 0
''' % modulas not a percent sign? How does it work? '''
# Example A divided by B with C remaing
# suppose if you divided
A = 17
B = 3
C = 17 % 3
print ('C', C) # will show remaing value
'''Python calculation order of operation - PEMDAS '''
# P = Parentheses
# E = Exponents
# M = Multiplication
# D = Division
# A = Adition
# S = Substract
''' / (divide) round down'''
#it is not really rounding down, rather it is just dropping fractional
#part after decemial point
# Example
x = 11.0
y = 4.0
z = 11.0/4.0
print('Z =',z) # will drop the fractional part
z = 11/4
print('Z=',z) # will drop the fractional part