summaryrefslogtreecommitdiff
path: root/comp
diff options
context:
space:
mode:
authorstandenboy <standenboy@StandenboyLAP.lan>2024-01-29 13:03:11 +0000
committerstandenboy <standenboy@StandenboyLAP.lan>2024-01-29 13:03:11 +0000
commit073f1ce23d470bd85b0eb7497308f879ee214a48 (patch)
tree952fe9390276a8d7158a706aaf4231e44ebb9ff0 /comp
parenteb1a5582181bf3188f30d665a295321d36bdc795 (diff)
added 106
Diffstat (limited to 'comp')
-rw-r--r--comp/hw/106/1.py4
-rw-r--r--comp/hw/106/2.py7
-rw-r--r--comp/hw/106/3.py9
-rw-r--r--comp/notes/7/oop25
4 files changed, 45 insertions, 0 deletions
diff --git a/comp/hw/106/1.py b/comp/hw/106/1.py
new file mode 100644
index 0000000..f465ed8
--- /dev/null
+++ b/comp/hw/106/1.py
@@ -0,0 +1,4 @@
+first = input("first name: ")
+last = input("last name ")
+
+print(first[::-1], " ", last[::-1])
diff --git a/comp/hw/106/2.py b/comp/hw/106/2.py
new file mode 100644
index 0000000..f537aa4
--- /dev/null
+++ b/comp/hw/106/2.py
@@ -0,0 +1,7 @@
+num = int(input("num: "))
+
+if (num % 2) == 0:
+ print("its even")
+else:
+ print("is odd")
+
diff --git a/comp/hw/106/3.py b/comp/hw/106/3.py
new file mode 100644
index 0000000..3f48f70
--- /dev/null
+++ b/comp/hw/106/3.py
@@ -0,0 +1,9 @@
+vowels = ['a','e','i','o','u']
+
+counter = 0
+word = input()
+for i in word:
+ for j in vowels:
+ if j == i:
+ counter = counter + 1
+print(counter)
diff --git a/comp/notes/7/oop b/comp/notes/7/oop
new file mode 100644
index 0000000..b0bfef3
--- /dev/null
+++ b/comp/notes/7/oop
@@ -0,0 +1,25 @@
+attributes are vairables in classes
+methods are functions in classes
+
+instanciate -> create an instance of a class, will give you an object that you can interacte with
+
+a class is a bit like a function that returns a specific data structure
+
+a procedure changes an attribute in an object
+
+a function returns the value of an attribute
+
+a constructor is a function that initializes the object when you instanciate the class
+
+an attribute is a private variable, can only be changed using a procedure in the class
+
+a procedure or funtion is (normally) public, and can be acessed anywhere in code
+
+
+getters and setters
+a getter will return a value of an attribute
+
+a setter will set an attribute
+
+
+