Skip to content

Commit e913a40

Browse files
authored
Added Classes and Objects - Lab **and** advanced certificate. (#43)
2 parents 880285d + a3f5019 commit e913a40

File tree

10 files changed

+100
-1
lines changed

10 files changed

+100
-1
lines changed

Diff for: Advanced/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
<img width="300" src="https://user-images.githubusercontent.com/112943652/221200590-93edf542-a3af-4719-ab46-bc50390e1946.png">
2+
13
| Python Advanced |
24
| ---------------- |
35
| <a href="1.Stacks, Queues, Tuples and Sets">Stacks, Queues, Tuples and Sets</a> |

Diff for: OOP/2.Classes and Objects/# TODO.txt

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Vehicle:
2+
3+
def __init__(self, mileage, max_speed=150):
4+
self.mileage = mileage
5+
self.max_speed = max_speed
6+
self.gadgets = []
7+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Point:
2+
3+
def __init__(self, x, y):
4+
self.x = x
5+
self.y = y
6+
7+
def set_x(self, new_x):
8+
self.x = new_x
9+
10+
def set_y(self, new_y):
11+
self.y = new_y
12+
13+
def __str__(self):
14+
return f"The point has coordinates ({self.x},{self.y})"
15+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
class Circle:
2+
pi = 3.14
3+
4+
def __init__(self, radius):
5+
self.radius = radius
6+
7+
def set_radius(self, new_radius):
8+
self.radius = new_radius
9+
10+
def get_area(self):
11+
return self.radius ** 2 * Circle.pi
12+
13+
def get_circumference(self):
14+
return self.radius * 2 * Circle.pi
15+
16+
17+
''' TEST '''
18+
# circle = Circle(10)
19+
# circle.set_radius(12)
20+
# print(circle.get_area())
21+
# print(circle.get_circumference())
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class Glass:
2+
capacity = 250
3+
4+
def __init__(self):
5+
self.content = 0
6+
7+
def fill(self, ml):
8+
if self.content + ml <= Glass.capacity:
9+
self.content += ml
10+
return f"Glass filled with {ml} ml"
11+
return f"Cannot add {ml} ml"
12+
13+
def empty(self):
14+
self.content = 0
15+
return "Glass is now empty"
16+
17+
def info(self):
18+
return f"{Glass.capacity - self.content} ml left"
19+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
class Smartphone:
2+
3+
def __init__(self, memory):
4+
self.memory = memory
5+
self.apps = []
6+
self.is_on = False
7+
8+
def power(self):
9+
self.is_on = False if self.is_on else True
10+
11+
def install(self, app, app_memory):
12+
if self.memory - app_memory >= 0 and self.is_on:
13+
self.memory -= app_memory
14+
self.apps.append(app)
15+
return f"Installing {app}"
16+
17+
elif self.memory - app_memory >= 0:
18+
return f"Turn on your phone to install {app}"
19+
20+
return f"Not enough memory to install {app}"
21+
22+
def status(self):
23+
return f"Total apps: {len(self.apps)}. Memory left: {self.memory}"
24+

Diff for: OOP/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@
44
| ------------------------ |
55
| <a href="1.First Steps in OOP/First Steps in OOP - Lab">First Steps in OOP</a> |
66
| <a href="1.First Steps in OOP/First Steps in OOP - Exercise">Exercise: First Steps in OOP</a> |
7+
| ----------------------------- |
8+
| <a href="2.Classes and Objects">Classes and Objects</a> |
9+
| ------------------ |
10+
| <a href="2.Classes and Objects/Classes and Objects - Lab">Classes and Objects</a> |

Diff for: README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@ Course Lecturer - **[Mario Zahariev](https://github.com/zahariev-webbersof)**
55
<br>
66
Course Exercise Lecturer - **[Diyan Kalaydzhiev](https://github.com/DiyanKalaydzhiev23)**
77

8+
<!-- <p float="left"> -->
9+
<img width="250" src="https://user-images.githubusercontent.com/112943652/221198735-55e4de81-cd84-4e13-b77d-505d7eb1ba03.png">
10+
<!-- <img width="250" src="https://user-images.githubusercontent.com/112943652/221198735-55e4de81-cd84-4e13-b77d-505d7eb1ba03.png"> -->
11+
<!-- </p> -->
12+
813
| Python Advanced | Python OOP |
914
| --------------- | ---------- |
1015
| <a href="Advanced">Advanced</a> | <a href="OOP">Object Oriented Programming</a> |
1116
| <a href="Advanced/1.Stacks, Queues, Tuples and Sets">Stacks, Queues, Tuples and Sets</a> | <a href="OOP/1.First Steps in OOP">First Steps in OOP</a> |
12-
| <a href="Advanced/2.Multidimensional Lists">Multidimensional Lists (AKA matrix)</a> | Classes and Objects |
17+
| <a href="Advanced/2.Multidimensional Lists">Multidimensional Lists (AKA matrix)</a> | <a href="OOP/2.Classes and Objects">Classes and Objects</a> |
1318
| <a href="Advanced/3.Functions Advanced">Functions Advanced</a> | Inheritance |
1419
| <a href="Advanced/4.Error Handling">Error Handling</a> | Encapsulation |
1520
| <a href="Advanced/5.File Handling">File Handling</a> | Static and Class Methods |

Diff for: advanced_cretificate.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
![Advanced certificate](https://user-images.githubusercontent.com/112943652/221198735-55e4de81-cd84-4e13-b77d-505d7eb1ba03.png)
2+
![Advanced curriculum](https://user-images.githubusercontent.com/112943652/221198752-04b2dfab-b8fb-4688-8c17-1c5a5986513b.png)

0 commit comments

Comments
 (0)