summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstandenboy <standenboy@seacrossedlovers.xyz>2024-03-18 13:21:36 +0000
committerstandenboy <standenboy@seacrossedlovers.xyz>2024-03-18 13:21:36 +0000
commitc696b4d6ded69074cd08c51b91eabeaeac5823ac (patch)
treeee8b7ff08580a3bffc237c5b8bac9a8bc26d2516
parent647d3b98658ddae66882badc508633c9a33eff32 (diff)
did homework
-rw-r--r--comp/hw/114/1.py42
-rw-r--r--comp/work/24/queues.py18
-rw-r--r--comp/work/26/tree.py12
-rw-r--r--comp/work/28/1.py26
-rw-r--r--comp/work/28/2.py10
-rw-r--r--comp/work/28/3.py12
-rw-r--r--goal5
-rw-r--r--screen.corebin693104 -> 0 bytes
8 files changed, 125 insertions, 0 deletions
diff --git a/comp/hw/114/1.py b/comp/hw/114/1.py
new file mode 100644
index 0000000..8abeb3f
--- /dev/null
+++ b/comp/hw/114/1.py
@@ -0,0 +1,42 @@
+class vehicle:
+ def __init__(self, name, max_speed, miles):
+ self.__name = name
+ self.__max_speed = max_speed
+ self.__miles = miles
+
+ def get_name(self):
+ return self.__name
+
+ def get_max_speed(self):
+ return self.__max_speed
+
+ def get_miles(self):
+ return self.__miles
+
+ def display_info(self):
+ print(f"{self.__name}, {self.__max_speed}, {self.__miles}")
+
+
+class bus(vehicle):
+ def __init__(self, name, max_speed, miles, capacity):
+ super().__init__(name, max_speed, miles)
+ self.__capacity = capacity
+
+ def get_capacity(self):
+ return self.__capacity
+
+ def set_capacity(self, new):
+ self.__capacity = new
+
+ def display_info(self):
+ print(f"{super().get_name()}, {super().get_max_speed()}, {super().get_miles()}, {self.__capacity}")
+
+
+car1 = vehicle("car", 137, 55)
+
+bus = bus("bussy", 80, 10, 0)
+bus.set_capacity(80)
+
+car1.display_info()
+bus.display_info()
+
diff --git a/comp/work/24/queues.py b/comp/work/24/queues.py
new file mode 100644
index 0000000..8688af6
--- /dev/null
+++ b/comp/work/24/queues.py
@@ -0,0 +1,18 @@
+class Queue:
+ def __sizeof(self):
+ return len(self.__queue)
+
+ def __shift(self):
+ new = []
+ for i in self.__queue
+
+ def __init__(self, maxsize):
+ self.__maxsize = maxsize
+ self.__queue = []
+
+ def add(self, data):
+ if self.__sizeof(self) < self.__maxsize:
+ self.__queue.append(data)
+
+ def remove(self):
+ self.__queue.pop(0)
diff --git a/comp/work/26/tree.py b/comp/work/26/tree.py
new file mode 100644
index 0000000..428f3aa
--- /dev/null
+++ b/comp/work/26/tree.py
@@ -0,0 +1,12 @@
+tree = [
+ ['a', ['b']],
+ ['b', ['c']],
+ ['c', ['c']]
+]
+
+
+def convertTree(myTree):
+ output = []
+ return output
+
+print(convertTree(tree))
diff --git a/comp/work/28/1.py b/comp/work/28/1.py
new file mode 100644
index 0000000..5c8598c
--- /dev/null
+++ b/comp/work/28/1.py
@@ -0,0 +1,26 @@
+def addative(num):
+ if len(num) >= 2:
+ new = 0
+ for i in num:
+ new = new + int(i)
+ return 1 + addative(str(new))
+ else:
+ return 0
+
+
+def multiplative(num):
+ if len(num) >= 2:
+ new = 1
+ for i in num:
+ new = new * int(i)
+ return 1 + addative(str(new))
+ else:
+ return 0
+
+
+num = input("number: ")
+
+if input("m/a: ") == "m":
+ print(multiplative(str(num)))
+else:
+ print(addative(str(num)))
diff --git a/comp/work/28/2.py b/comp/work/28/2.py
new file mode 100644
index 0000000..5e344e4
--- /dev/null
+++ b/comp/work/28/2.py
@@ -0,0 +1,10 @@
+def gcf(num1, num2):
+ while num1 != num2:
+ if (num1 > num2):
+ num1 = num1 - num2
+ else:
+ num2 = num2 - num1
+ return num1
+
+
+print(gcf(10, 20))
diff --git a/comp/work/28/3.py b/comp/work/28/3.py
new file mode 100644
index 0000000..c72e328
--- /dev/null
+++ b/comp/work/28/3.py
@@ -0,0 +1,12 @@
+number = 0
+while number < 1 or number > 10:
+ number = input("enter a postive number: ")
+ if number > 10:
+ print("number is too big")
+ else:
+ if number < 1:
+ print("not posative")
+c = 1
+for k in range(number-1):
+ print(c)
+ c = (c * number - 1 - k) / (k + 1)
diff --git a/goal b/goal
new file mode 100644
index 0000000..79b27ca
--- /dev/null
+++ b/goal
@@ -0,0 +1,5 @@
+3 months
+ -learn a new programing language (go, rust?)
+ --solution, read the docs
+ --solution, make some projects in the language
+
diff --git a/screen.core b/screen.core
deleted file mode 100644
index 8f7752a..0000000
--- a/screen.core
+++ /dev/null
Binary files differ