Skip to content

Commit 1a824f1

Browse files
committed
Add 09_numbers
1 parent 51c1aff commit 1a824f1

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

09_numbers/1_numbers.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Integer
2+
quantity = 4
3+
4+
# Float
5+
price = 2.5
6+
7+
# + - * / Operations with Integer and Float
8+
amount = quantity * price
9+
print(amount)
10+
11+
# int to float
12+
print(float(quantity))
13+
# int to string
14+
print(type(str(quantity)))
15+
# float to int
16+
print(int(price))
17+
# float to string
18+
print(type(str(price)))

09_numbers/2_random.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import random
2+
3+
print(random.randrange(5, 10))

09_numbers/3_math.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import math
2+
3+
print(math.pi)
4+
print(math.cos(math.pi))
5+
print(math.factorial(5))

0 commit comments

Comments
 (0)