summaryrefslogtreecommitdiff
path: root/comp/work
diff options
context:
space:
mode:
Diffstat (limited to 'comp/work')
-rwxr-xr-xcomp/work/1/areaCirc.py10
-rwxr-xr-xcomp/work/1/areaRect.py14
-rwxr-xr-xcomp/work/1/calcVAT6
-rwxr-xr-xcomp/work/1/fahToCel5
-rwxr-xr-xcomp/work/10/railfence.py19
-rwxr-xr-xcomp/work/11/area.py7
-rwxr-xr-xcomp/work/11/cinlinder.py6
-rwxr-xr-xcomp/work/11/isLetter.py7
-rwxr-xr-xcomp/work/11/numOfVowles.py8
-rwxr-xr-xcomp/work/11/volume.py5
-rwxr-xr-xcomp/work/11/wage.py10
-rwxr-xr-xcomp/work/12/__pycache__/valid.cpython-312.pycbin0 -> 1408 bytes
-rwxr-xr-xcomp/work/12/usingModdules.py3
-rwxr-xr-xcomp/work/12/valid.py60
-rwxr-xr-xcomp/work/13/find_smallest.py9
-rwxr-xr-xcomp/work/13/reverse_words.py6
-rwxr-xr-xcomp/work/13/task.py14
-rwxr-xr-xcomp/work/2/fstring.py4
-rwxr-xr-xcomp/work/2/pi.py2
-rwxr-xr-xcomp/work/2/shops.py25
-rwxr-xr-xcomp/work/2/syntaxError6
-rwxr-xr-xcomp/work/3/isIn.c19
-rwxr-xr-xcomp/work/3/isSquare.py5
-rwxr-xr-xcomp/work/3/password.py6
-rwxr-xr-xcomp/work/3/year.py4
-rwxr-xr-xcomp/work/4/pythagorus6
-rwxr-xr-xcomp/work/4/sumAndMean6
-rwxr-xr-xcomp/work/5/567.py10
-rwxr-xr-xcomp/work/5/name.py5
-rwxr-xr-xcomp/work/5/odd.py3
-rwxr-xr-xcomp/work/5/printCon5
-rwxr-xr-xcomp/work/5/wordCount.py12
-rwxr-xr-xcomp/work/5/xTo.py2
-rwxr-xr-xcomp/work/6/5timesTable.py8
-rwxr-xr-xcomp/work/6/cake.py8
-rwxr-xr-xcomp/work/6/iceCream.py29
-rwxr-xr-xcomp/work/7/dice.py26
-rwxr-xr-xcomp/work/7/famous.py26
-rwxr-xr-xcomp/work/7/friends.py7
-rwxr-xr-xcomp/work/7/input.py18
-rwxr-xr-xcomp/work/8/asciibin0 -> 18376 bytes
-rwxr-xr-xcomp/work/8/ascii.c7
-rwxr-xr-xcomp/work/8/ascii_wordbin0 -> 18568 bytes
-rwxr-xr-xcomp/work/8/ascii_word.c11
-rwxr-xr-xcomp/work/8/paritybin0 -> 18376 bytes
-rwxr-xr-xcomp/work/8/parity.c34
-rwxr-xr-xcomp/work/9/scores.py21
-rwxr-xr-xcomp/work/9/tanks.py10
48 files changed, 514 insertions, 0 deletions
diff --git a/comp/work/1/areaCirc.py b/comp/work/1/areaCirc.py
new file mode 100755
index 0000000..5c5deac
--- /dev/null
+++ b/comp/work/1/areaCirc.py
@@ -0,0 +1,10 @@
+import math
+
+radius = float(input("radius of the circle: "))
+
+area = (math.pi) * (radius * radius)
+
+areaInPi = area / math.pi
+
+print("the area of a circle with a radius of", radius, "is", area, "(",areaInPi,"PI )")
+
diff --git a/comp/work/1/areaRect.py b/comp/work/1/areaRect.py
new file mode 100755
index 0000000..e96af85
--- /dev/null
+++ b/comp/work/1/areaRect.py
@@ -0,0 +1,14 @@
+print("This program calculates the area of a rectangle")
+
+length = float(input("Type in the length : "))
+
+width = float(input("Type in the width : "))
+
+perimeter = (length * 2) + (width *2)
+
+area = length * width
+
+print("The area of the rectangle with a length of", length, "and a width of", width, "is", area)
+print("The perimiter of the rectangle with a length of", length, "and a width of", width, "is", perimeter)
+
+
diff --git a/comp/work/1/calcVAT b/comp/work/1/calcVAT
new file mode 100755
index 0000000..bcebd93
--- /dev/null
+++ b/comp/work/1/calcVAT
@@ -0,0 +1,6 @@
+startingMoney = float(input("starting money: "))
+
+endingMoney = startingMoney - (startingMoney * 0.2)
+endingMoney = format(endingMoney, ".2f")
+
+print("you now have", endingMoney)
diff --git a/comp/work/1/fahToCel b/comp/work/1/fahToCel
new file mode 100755
index 0000000..e412c72
--- /dev/null
+++ b/comp/work/1/fahToCel
@@ -0,0 +1,5 @@
+inputTemp = float(input("Temprature in fahrenheit: "))
+
+convertedTemp = (5 / 9) * (inputTemp - 32)
+
+print("the converted temp is", convertedTemp)
diff --git a/comp/work/10/railfence.py b/comp/work/10/railfence.py
new file mode 100755
index 0000000..c91d491
--- /dev/null
+++ b/comp/work/10/railfence.py
@@ -0,0 +1,19 @@
+string = "HELLO_THERE"
+shift = 4
+hidden = []
+tmp = ""
+for i in string:
+ if len(tmp) + 1 > shift:
+ hidden.append(tmp)
+ tmp = ""
+ tmp = tmp + i
+if len(tmp) != 0:
+ hidden.append(tmp)
+final = []
+for i in range(shift):
+ for j in hidden:
+ try:
+ final.append(j[i])
+ except:
+ pass
+print(final)
diff --git a/comp/work/11/area.py b/comp/work/11/area.py
new file mode 100755
index 0000000..c4e2359
--- /dev/null
+++ b/comp/work/11/area.py
@@ -0,0 +1,7 @@
+def area(length, height):
+ return length * height
+
+length = int(input("the length of the shape: "))
+height = int(input("the height of the shape: "))
+
+print(area(length,height))
diff --git a/comp/work/11/cinlinder.py b/comp/work/11/cinlinder.py
new file mode 100755
index 0000000..3fc1972
--- /dev/null
+++ b/comp/work/11/cinlinder.py
@@ -0,0 +1,6 @@
+import math
+
+def volume(height, radius):
+ return ((math.pi * radius**2) * height)
+
+print(volume(10, 3))
diff --git a/comp/work/11/isLetter.py b/comp/work/11/isLetter.py
new file mode 100755
index 0000000..593ff5e
--- /dev/null
+++ b/comp/work/11/isLetter.py
@@ -0,0 +1,7 @@
+import string
+def isLetter(letter):
+ for i in list(string.ascii_lowercase):
+ if letter == i:
+ return True
+ return False
+print(isLetter('1'))
diff --git a/comp/work/11/numOfVowles.py b/comp/work/11/numOfVowles.py
new file mode 100755
index 0000000..77ab199
--- /dev/null
+++ b/comp/work/11/numOfVowles.py
@@ -0,0 +1,8 @@
+def count(string):
+ counter = 0
+ for i in string.lower():
+ for j in ["a","e","i","o","u"]:
+ if i == j:
+ counter = counter + 1
+ return counter
+print(count("hello"))
diff --git a/comp/work/11/volume.py b/comp/work/11/volume.py
new file mode 100755
index 0000000..3963b4a
--- /dev/null
+++ b/comp/work/11/volume.py
@@ -0,0 +1,5 @@
+def volume(x,y,z):
+ return x*y*z
+
+
+print(volume(5,6,3))
diff --git a/comp/work/11/wage.py b/comp/work/11/wage.py
new file mode 100755
index 0000000..4dbba7f
--- /dev/null
+++ b/comp/work/11/wage.py
@@ -0,0 +1,10 @@
+def wage(hours, rate):
+ pay = 0
+ for i in range(hours):
+ if i < 35:
+ pay = pay + rate
+ else:
+ pay = pay + (rate + (rate * 0.5))
+ return pay
+
+print(wage(40, 10))
diff --git a/comp/work/12/__pycache__/valid.cpython-312.pyc b/comp/work/12/__pycache__/valid.cpython-312.pyc
new file mode 100755
index 0000000..400cc75
--- /dev/null
+++ b/comp/work/12/__pycache__/valid.cpython-312.pyc
Binary files differ
diff --git a/comp/work/12/usingModdules.py b/comp/work/12/usingModdules.py
new file mode 100755
index 0000000..491ff3f
--- /dev/null
+++ b/comp/work/12/usingModdules.py
@@ -0,0 +1,3 @@
+import valid
+
+print(valid.validName("lucas"))
diff --git a/comp/work/12/valid.py b/comp/work/12/valid.py
new file mode 100755
index 0000000..0f2e403
--- /dev/null
+++ b/comp/work/12/valid.py
@@ -0,0 +1,60 @@
+def validName(name):
+ valid = True
+ for letter in name:
+ if letter.upper() > "Z" or letter.upper() < "A":
+ if letter != "-" and letter != " ":
+ valid = False
+ return valid
+
+def validNumber(number):
+ try:
+ int(number)
+ except:
+ return False
+ return True
+
+def validYear(year):
+ year = int(year)
+ if year < 1900:
+ return False
+ if year > 2099:
+ return False
+ return True
+
+def validMonth(month):
+ month = int(month)
+ if month <= 0:
+ return False
+ if month > 12:
+ return False
+ return True
+
+def rangeCheck(number, lower, upper):
+ if number > upper or number < lower:
+ return False
+ return True
+
+def dateCheck(date):
+ if len(date) != 10:
+ return False
+ if not(validNumber(date[0]) and validNumber(date[1]):
+ return False
+ if not(validNumber(date[3]) and validNumber(date[4]):
+ return False
+ if not(validNumber(date[6]) and validNumber(date[7]) and validNumber(date[8]) and validNumber(date[9]):
+ return False
+ return True
+
+if __name__ == "__main__":
+ firstName = input("Please type in your firstname: ")
+ number = input("please type a phone number: ")
+ year = input("what is the year: ")
+
+ while not(validName(firstName)):
+ firstName = input("Please type in your firstname: ")
+
+ while not(validNumber(number)):
+ number = input("Please type in a valid phone number: ")
+
+ while not(validYear(year)):
+ year = input("Please type in a valid year: ")
diff --git a/comp/work/13/find_smallest.py b/comp/work/13/find_smallest.py
new file mode 100755
index 0000000..362383a
--- /dev/null
+++ b/comp/work/13/find_smallest.py
@@ -0,0 +1,9 @@
+def find_smallest(numbers):
+ smallest = numbers[0]
+ for i in numbers:
+ if i < smallest:
+ smallest = i
+ return smallest
+
+numbers = [3, 6, 2, 8, 4, 1]
+print(find_smallest(numbers))
diff --git a/comp/work/13/reverse_words.py b/comp/work/13/reverse_words.py
new file mode 100755
index 0000000..974ae4d
--- /dev/null
+++ b/comp/work/13/reverse_words.py
@@ -0,0 +1,6 @@
+def reverse_words(words):
+ words.split(" ")
+ output = []
+ for i in words:
+
+
diff --git a/comp/work/13/task.py b/comp/work/13/task.py
new file mode 100755
index 0000000..ca7cd5e
--- /dev/null
+++ b/comp/work/13/task.py
@@ -0,0 +1,14 @@
+def get_name(name):
+ return name.upper()
+
+
+def get_age(current_age):
+ return current_age + 1
+
+def get_details(name,age):
+ print(f"the persons name is {get_name(name)}, and next year they will be {get_age(age)}")
+
+name = input("name: ")
+age = int(input("current age: "))
+
+get_details(name,age)
diff --git a/comp/work/2/fstring.py b/comp/work/2/fstring.py
new file mode 100755
index 0000000..80d7d7c
--- /dev/null
+++ b/comp/work/2/fstring.py
@@ -0,0 +1,4 @@
+red = "\e[1;35m"
+normal = "\e[0;37m"
+
+print(f"{red}hello{normal}")
diff --git a/comp/work/2/pi.py b/comp/work/2/pi.py
new file mode 100755
index 0000000..93f216d
--- /dev/null
+++ b/comp/work/2/pi.py
@@ -0,0 +1,2 @@
+import math
+print(f"{math.pi:.48f}")
diff --git a/comp/work/2/shops.py b/comp/work/2/shops.py
new file mode 100755
index 0000000..57cff25
--- /dev/null
+++ b/comp/work/2/shops.py
@@ -0,0 +1,25 @@
+total = int(input("how much does it cost: "))
+totalPayed = int(input("how much did you get: "))
+
+if totalPayed < total:
+ print(f"{totalPayed:.2f} is not enough to pay for {total:.2f}")
+ exit()
+
+totalChange = totalPayed - total
+changeToGive = []
+while totalChange != 0:
+ if totalChange >= 10:
+ totalChange = totalChange - 10
+ changeToGive.append(10)
+ elif totalChange >= 5:
+ totalChange = totalChange - 5
+ changeToGive.append(5)
+ elif totalChange >= 2:
+ totalChange = totalChange - 2
+ changeToGive.append(2)
+ elif totalChange >= 1:
+ totalChange = totalChange - 1
+ changeToGive.append(1)
+
+print(f"you need to give the customer : {changeToGive}")
+
diff --git a/comp/work/2/syntaxError b/comp/work/2/syntaxError
new file mode 100755
index 0000000..988177a
--- /dev/null
+++ b/comp/work/2/syntaxError
@@ -0,0 +1,6 @@
+print = ("....") print("...")
+ ^
+heigth-Str = input("...") height = int(input("..."))
+ ^
+base-Str = input("...") base = int(input("..."))
+ ^
diff --git a/comp/work/3/isIn.c b/comp/work/3/isIn.c
new file mode 100755
index 0000000..8254099
--- /dev/null
+++ b/comp/work/3/isIn.c
@@ -0,0 +1,19 @@
+#include<stdlib.h>
+#include<stdio.h>
+#include<string.h>
+
+int isIn(char str1[], char str2[]){
+ int str1Length = strlen(str1);
+ int str2Length = strlen(str2);
+
+ for (int i = 0; i < str1Length; i++){
+ for (int j = 0; j < str2Length; i++){
+ if (str1[i] == str2[j]){
+ return 0;
+ }
+ }
+}
+
+int main(){
+
+}
diff --git a/comp/work/3/isSquare.py b/comp/work/3/isSquare.py
new file mode 100755
index 0000000..5dea990
--- /dev/null
+++ b/comp/work/3/isSquare.py
@@ -0,0 +1,5 @@
+base = int(input("height: "))
+height = int(input("base: "))
+
+if base == height:
+ print("its a square")
diff --git a/comp/work/3/password.py b/comp/work/3/password.py
new file mode 100755
index 0000000..7a592d8
--- /dev/null
+++ b/comp/work/3/password.py
@@ -0,0 +1,6 @@
+password = "beans"
+
+if input("password: ") == password:
+ print("welcome back beany bob")
+else:
+ print("password was wrong")
diff --git a/comp/work/3/year.py b/comp/work/3/year.py
new file mode 100755
index 0000000..854c2c5
--- /dev/null
+++ b/comp/work/3/year.py
@@ -0,0 +1,4 @@
+year = int(input("whats the year? "))
+
+if (year % 4) == 0:
+ print("its a leep year")
diff --git a/comp/work/4/pythagorus b/comp/work/4/pythagorus
new file mode 100755
index 0000000..d9c5cdc
--- /dev/null
+++ b/comp/work/4/pythagorus
@@ -0,0 +1,6 @@
+#!/usr/bin/python
+base = float(input("base: "))
+height = float(input("height: "))
+
+hyp = ((base ** 2) + (height ** 2)) ** 0.5
+print(hyp)
diff --git a/comp/work/4/sumAndMean b/comp/work/4/sumAndMean
new file mode 100755
index 0000000..1d46136
--- /dev/null
+++ b/comp/work/4/sumAndMean
@@ -0,0 +1,6 @@
+#!/usr/bin/python3
+numbers = []
+for i in range(5):
+ numbers.append(int(input(f"num {i}: ")))
+print(f"sum = {float(sum(numbers))}")
+print(f"average = {(sum(numbers) / 5)}")
diff --git a/comp/work/5/567.py b/comp/work/5/567.py
new file mode 100755
index 0000000..691d278
--- /dev/null
+++ b/comp/work/5/567.py
@@ -0,0 +1,10 @@
+import sys
+
+for x in range(1,11):
+ for i in range(x, (x*10)+1):
+ if i % x == 0:
+ if i >= 10:
+ sys.stdout.write(str(i)+" ")
+ else:
+ sys.stdout.write(str(i)+" ")
+ print("")
diff --git a/comp/work/5/name.py b/comp/work/5/name.py
new file mode 100755
index 0000000..b822ae8
--- /dev/null
+++ b/comp/work/5/name.py
@@ -0,0 +1,5 @@
+name = input("name: ")
+counter = len(name)
+for i in name:
+ print(f"{name:.{counter}}")
+ counter = counter - 1
diff --git a/comp/work/5/odd.py b/comp/work/5/odd.py
new file mode 100755
index 0000000..7fde107
--- /dev/null
+++ b/comp/work/5/odd.py
@@ -0,0 +1,3 @@
+for i in range(40):
+ if i % 2 != 0:
+ print(i)
diff --git a/comp/work/5/printCon b/comp/work/5/printCon
new file mode 100755
index 0000000..da5a756
--- /dev/null
+++ b/comp/work/5/printCon
@@ -0,0 +1,5 @@
+word = "computing"
+for i in word:
+ if i != 'a' and i != 'e' and i != 'i' and i != 'o' and i != 'u':
+ print(i)
+
diff --git a/comp/work/5/wordCount.py b/comp/work/5/wordCount.py
new file mode 100755
index 0000000..8674b3f
--- /dev/null
+++ b/comp/work/5/wordCount.py
@@ -0,0 +1,12 @@
+sentence = input("sentence: ")
+
+cons = 0
+spaces = 0
+
+for i in sentence:
+ if i == ' ':
+ spaces =+ 1
+
+ if i != 'a' and i != 'e' and i != 'i' and i != 'o' and i != 'u':
+ cons = cons + 1
+print("there are", cons - 2, "consinants and", spaces + 2, "words")
diff --git a/comp/work/5/xTo.py b/comp/work/5/xTo.py
new file mode 100755
index 0000000..84c67bb
--- /dev/null
+++ b/comp/work/5/xTo.py
@@ -0,0 +1,2 @@
+for i in range(21):
+ print(i, i**2, i**3)
diff --git a/comp/work/6/5timesTable.py b/comp/work/6/5timesTable.py
new file mode 100755
index 0000000..e7be413
--- /dev/null
+++ b/comp/work/6/5timesTable.py
@@ -0,0 +1,8 @@
+num = int(input("number: "))
+
+if num < 0:
+ exit(1)
+
+for i in range(num+1):
+ if (i % 5) == 0:
+ print(i)
diff --git a/comp/work/6/cake.py b/comp/work/6/cake.py
new file mode 100755
index 0000000..23f4e44
--- /dev/null
+++ b/comp/work/6/cake.py
@@ -0,0 +1,8 @@
+while True:
+ eggs = int(input("how many eggs are there: "))
+ if eggs < 8:
+ break
+flour = eggs * 100
+sugar = eggs * 50
+
+print("you will need", flour, "grams and", sugar, "grams")
diff --git a/comp/work/6/iceCream.py b/comp/work/6/iceCream.py
new file mode 100755
index 0000000..10db61c
--- /dev/null
+++ b/comp/work/6/iceCream.py
@@ -0,0 +1,29 @@
+while True:
+ week = input("is it a week day: (yes/no) ").lower()
+ if week == "yes":
+ break
+ elif week == "no":
+ break
+
+while True:
+ temp = int(input("what is the temprature: "))
+ if temp >= 20:
+ if temp <= 45:
+ break
+sold = 0
+if week == "no":
+ if 20 <= temp <= 30:
+ sold = 200
+ elif 31 <= temp <= 38:
+ sold = 300
+ else:
+ sold = 240
+elif week == "yes":
+ if 20 <= temp <= 30:
+ sold = 200/2
+ elif 31 <= temp <= 38:
+ sold = 300/2
+ else:
+ sold = 240/2
+print(sold, "ice creams will be sold")
+
diff --git a/comp/work/7/dice.py b/comp/work/7/dice.py
new file mode 100755
index 0000000..83ec09c
--- /dev/null
+++ b/comp/work/7/dice.py
@@ -0,0 +1,26 @@
+import random
+
+dice = []
+for i in range(200):
+ dice.append(random.randint(1, 6))
+
+count = []
+for i in range(6):
+ count.append(0)
+for i in dice:
+ if i == 1:
+ count[0] = count[0] + 1
+ elif i == 2:
+ count[1] = count[1] + 1
+ elif i == 3:
+ count[2] = count[2] + 1
+ elif i == 4:
+ count[3] = count[3] + 1
+ elif i == 5:
+ count[4] = count[4] + 1
+ else:
+ count[5] = count[5] + 1
+
+for i in range(len(count)):
+ print("there are", count[i], str(i)+"'s")
+
diff --git a/comp/work/7/famous.py b/comp/work/7/famous.py
new file mode 100755
index 0000000..7da792f
--- /dev/null
+++ b/comp/work/7/famous.py
@@ -0,0 +1,26 @@
+name = ["tux", "wibler", "rms"]
+clue1 = ["its a penguin", "it likes art", "what your refering to..."]
+clue2 = ["it could have been a furry", "its a dog", "...as linux, is accutally gnu/linux"]
+
+score = 0
+
+for x in range(3):
+ print(clue1[x])
+ guess = input("who do you think it is? ")
+ if guess == name[x]:
+ print("you got it!")
+ score = score + 5
+ else:
+ print(clue2[x])
+ guess = input("who do you think it is now? ")
+ if guess == name[x]:
+ print("well done, you got it that time!")
+ score = score + 2
+ else:
+ print("sorry that was wrong")
+ print("it was,", name[x])
+ print("\n\n\n")
+
+print("you got,", score, "points")
+
+
diff --git a/comp/work/7/friends.py b/comp/work/7/friends.py
new file mode 100755
index 0000000..5d23111
--- /dev/null
+++ b/comp/work/7/friends.py
@@ -0,0 +1,7 @@
+friends = ["john", "ben", "sam", "micky mouse", "donald duck"]
+
+print(*friends, sep='\n')
+friends.reverse()
+print("\n\n\n")
+print(*friends, sep='\n')
+
diff --git a/comp/work/7/input.py b/comp/work/7/input.py
new file mode 100755
index 0000000..a9e5c8f
--- /dev/null
+++ b/comp/work/7/input.py
@@ -0,0 +1,18 @@
+numbers = []
+for i in range(10):
+ numbers.append(int(input("number: ")))
+total = sum(numbers)
+mean = total / len(numbers)
+
+print("total =",total, "mean =",mean)
+
+above = 0
+for i in numbers:
+ if i < mean:
+ print(i, "is less than average (HA SMOL)")
+ elif i == mean:
+ print(i, "is average (BORINGGG)")
+ else:
+ print(i, "is more than average (DAMMNNNN)")
+ above = above + 1
+print(above, "numbers are above average")
diff --git a/comp/work/8/ascii b/comp/work/8/ascii
new file mode 100755
index 0000000..8260b96
--- /dev/null
+++ b/comp/work/8/ascii
Binary files differ
diff --git a/comp/work/8/ascii.c b/comp/work/8/ascii.c
new file mode 100755
index 0000000..751c1b9
--- /dev/null
+++ b/comp/work/8/ascii.c
@@ -0,0 +1,7 @@
+#include<stdio.h>
+
+int main(){
+ int c;
+ scanf("%c", &c);
+ printf("%d\n", c);
+}
diff --git a/comp/work/8/ascii_word b/comp/work/8/ascii_word
new file mode 100755
index 0000000..3ede671
--- /dev/null
+++ b/comp/work/8/ascii_word
Binary files differ
diff --git a/comp/work/8/ascii_word.c b/comp/work/8/ascii_word.c
new file mode 100755
index 0000000..ba9fa95
--- /dev/null
+++ b/comp/work/8/ascii_word.c
@@ -0,0 +1,11 @@
+#include<stdio.h>
+#include<string.h>
+int main(){
+ char sentence[1000];
+
+ fgets(sentence, 1000, stdin);
+ for (int i = 0; i < strlen(sentence) - 1; i++){
+ printf("%d \0 ", (int)sentence[i]);
+ }
+ printf("\n");
+}
diff --git a/comp/work/8/parity b/comp/work/8/parity
new file mode 100755
index 0000000..66738ce
--- /dev/null
+++ b/comp/work/8/parity
Binary files differ
diff --git a/comp/work/8/parity.c b/comp/work/8/parity.c
new file mode 100755
index 0000000..a87d07a
--- /dev/null
+++ b/comp/work/8/parity.c
@@ -0,0 +1,34 @@
+#include<stdio.h>
+#include<string.h>
+#include<stdlib.h>
+
+int main(){
+ char num[8];
+ int parity;
+ scanf("%s", num);
+ char number[8];
+ for (int i = 0; i < 8; i++){
+ if (i == 7){
+ if (num[i] == '1'){
+ parity = 1;
+ }else{
+ parity = 0;
+ }
+ }else{
+ if (num[i] == '1'){
+ number[i] = 1;
+ }else{
+ number[i] = 0;
+ }
+ }
+ }
+ int number_of_ones = 0;
+ for (int i = 0; i < 8; i++){
+ if (number[i] == 1){
+ number_of_ones++;
+ }
+ }
+ if (number_of_ones % 2 == parity){
+ printf("bad\n");
+ }
+}
diff --git a/comp/work/9/scores.py b/comp/work/9/scores.py
new file mode 100755
index 0000000..8abad3b
--- /dev/null
+++ b/comp/work/9/scores.py
@@ -0,0 +1,21 @@
+scores = [[]]
+for i in range(3):
+ tmp = []
+ for j in range(5):
+ tmp.append(int(input(f"num {j}: ")))
+ scores.append(tmp)
+
+scores.pop(0)
+for i in scores:
+ print(*i, "avg: ",(sum(i)/5), sep=" ")
+
+highest = scores[0][0]
+lowest = scores[0][0]
+for i in scores:
+ for j in i:
+ if j > highest:
+ highest = j
+ elif j < lowest:
+ lowest = j
+print(f"highest: {highest}, lowest: {lowest}")
+
diff --git a/comp/work/9/tanks.py b/comp/work/9/tanks.py
new file mode 100755
index 0000000..6584263
--- /dev/null
+++ b/comp/work/9/tanks.py
@@ -0,0 +1,10 @@
+board1 = [["."] * 10] * 10
+board2 = [["."] * 10] * 10
+
+for i in board1:
+ print(*i, sep=" ")
+for i in range(3):
+ board1[int(input("tank y: "))][int(input("tank x: "))] = "T"
+for i in board1:
+ print(*i, sep=" ")
+