school

thing1's amazing school repo
Log | Files | Refs | Submodules | README

commit e4864bf1cd9e192eb54e492aaf02a397e143539c
parent 073f1ce23d470bd85b0eb7497308f879ee214a48
Author: standenboy <standenboy@StandenboyLAP.lan>
Date:   Wed,  7 Feb 2024 13:25:38 +0000

added homework

Diffstat:
Acomp/hw/112/1.sql | 15+++++++++++++++
Acomp/hw/112/2.sql | 8++++++++
Acomp/work/22/classes.py | 20++++++++++++++++++++
Acomp/work/23/higherorder.py | 10++++++++++
Acomp/work/23/recursion.py | 7+++++++
Acomp/work/23/stack.py | 47+++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 107 insertions(+), 0 deletions(-)

diff --git a/comp/hw/112/1.sql b/comp/hw/112/1.sql @@ -0,0 +1,15 @@ +CREATE TABLE member ( + TEXT MEMBERID, + TEXT FORENAME, + TEXT LASTNAME, + INT MAXBOOKS + DOB DATEOFBIRTH +) + +SELECT BOOKID +FROM BOOK +WHERE AUTHOR = "DAVID FERGUSON" +AND PRICE < 25 +ORDER DESC + + diff --git a/comp/hw/112/2.sql b/comp/hw/112/2.sql @@ -0,0 +1,8 @@ +INSERT INTO RACE +VALUES (3,"BOYS",80,"HURDLES",13:30) + +UPDATE ATHLETE +WHERE ATHLETENUMBER = 27 +AND RACENUMBER = 6 +TIMESET = 0:18.76 + diff --git a/comp/work/22/classes.py b/comp/work/22/classes.py @@ -0,0 +1,20 @@ +class Human: + def __init__(self, name, height, eye): + self.__name = name + self.__height = height + self.__eye = eye + + def set_eye(self, new_color): + self.__eye = new_color + + def get_name(self): + return self.__name + + def get_eye(self): + return self.__eye + +human1 = Human('john','2cm','blue') + +human1.set_eye('green') + +print(human1.get_eye()) diff --git a/comp/work/23/higherorder.py b/comp/work/23/higherorder.py @@ -0,0 +1,10 @@ +def shout(word): + return (word.upper()) + +def wisper(word): + return (word.lower()) + +def say(func): + print(func("heLLo")) + +say(shout) diff --git a/comp/work/23/recursion.py b/comp/work/23/recursion.py @@ -0,0 +1,7 @@ +def factorial(num): + if num == 0: + return 0 + else: + return num + factorial(num - 1) + +print(factorial(23)) diff --git a/comp/work/23/stack.py b/comp/work/23/stack.py @@ -0,0 +1,47 @@ +class Stack: + def __init__(self, size): + self.maxSize = size + self.pointer = -1 + self.data = [] + + def peek(self): + print(self.data[self.pointer]) + + def push(self, element): + if self.pointer > self.maxSize: + exit(1) + else: + self.data.append(element) + self.pointer = self.pointer + 1 + + def pop(self): + self.data.pop() + self.pointer = self.pointer - 1 + + def isfull(self): + if len(self.data) == self.maxSize: + return True + else: + return False + + def isempty(self): + if len(self.data) == 0: + return True + else: + return False + + +mystack = Stack(10) + +myinternalstack = Stack(10) + +for i in range(10): + myinternalstack.push("hello") + + +for i in range(10): + mystack.push(myinternalstack) + +mystack.peek() + +