diff options
author | standenboy <standenboy@seacrossedlovers.xyz> | 2023-12-15 10:19:20 +0000 |
---|---|---|
committer | standenboy <standenboy@seacrossedlovers.xyz> | 2023-12-15 10:19:20 +0000 |
commit | 4a95719d58a708ad55b1389631d6339047f786a0 (patch) | |
tree | 26cb6fc2dbe7fa75f57f1d6fb13aff8955772b56 |
added existing work
76 files changed, 931 insertions, 0 deletions
diff --git a/comp/hw/1/1.py b/comp/hw/1/1.py new file mode 100755 index 0000000..4eee13e --- /dev/null +++ b/comp/hw/1/1.py @@ -0,0 +1,4 @@ +num = int(input("number: ")) +for i in range(10,21): + if num == i: + print("is in range") diff --git a/comp/hw/1/2.py b/comp/hw/1/2.py new file mode 100755 index 0000000..dd1c619 --- /dev/null +++ b/comp/hw/1/2.py @@ -0,0 +1,7 @@ +age = int(input("age: ")) +if age >= 18: + print("user is an adult") +elif age < 13: + print("user is a child") +else: + print("user is a teenager") diff --git a/comp/hw/1/3.py b/comp/hw/1/3.py new file mode 100755 index 0000000..a84d7e2 --- /dev/null +++ b/comp/hw/1/3.py @@ -0,0 +1,10 @@ +import sys +num = [] +num.append(int(input("number: "))) +num.append(int(input("number: "))) +num.append(int(input("number: "))) + +num.sort() +for i in num: + sys.stdout.write(f"{i} ") +print("\n") diff --git a/comp/hw/1/4.py b/comp/hw/1/4.py new file mode 100755 index 0000000..fb28133 --- /dev/null +++ b/comp/hw/1/4.py @@ -0,0 +1,31 @@ +marks = [] +marks.append(int(input("analysis: "))) +marks.append(int(input("design: "))) +marks.append(int(input("implimentation: "))) +marks.append(int(input("evaluation: "))) + +total = 0 +for i in marks: + total = total + i + +if total >= 80: + print("9") +elif 80 > total >= 67: + print("8") +elif 67 < total <= 54: + print("7") +elif 54 < total <= 41: + print("6") +elif 41 < total <= 31: + print("5") +elif 31 < total <= 22: + print("4") +elif 22 < total <= 13: + print("3") +elif 13 < total <= 4: + print("2") +elif 4 < total <= 2: + print("1") +else: + print("U") +print("total ", total) diff --git a/comp/notes/1 b/comp/notes/1 new file mode 100755 index 0000000..3ce4743 --- /dev/null +++ b/comp/notes/1 @@ -0,0 +1,25 @@ +lesson 1 + +looking at binary +ordinal numbers - indexes, counters etc +natural numbers - start from 0 +intergers - just any number +rational numbers - just decimals + +should learn negative binary and floating point binary + +normal multiplication works in binary as well, its just multiplying by 1 or 0 + +we looked at binary addition and multiplication + +we looked at hex to denary + +gonna do some programming + + +todo: + floating point binary + negative binary + hex addition and multiplication +`done! + diff --git a/comp/notes/2 b/comp/notes/2 new file mode 100755 index 0000000..c0f686d --- /dev/null +++ b/comp/notes/2 @@ -0,0 +1,20 @@ +starting task +1) 103 +2) 10 10011011 +3) 10101001 x wrong numbers used +4) binary, denary, hexadecimal, octodecimal (base 8) x natural rational integer real + +from gcse remember spliting a binary number every 4 bits and convert to hex + +when you have signed bit it means - of the bit that is signed (usualy 128) + all the other values +your colums would be -128, 64, 32, 16, 8, 4, 2, 1 +if you have less bits it might look like this -8, 4, 2, 1 +same for if you have more bits + +we did some fixed point binary, it goes like this, -128, 64, 32, 16, 8, 4, 2, 1, 0.5, 0.25.. +it is clear why we use floating point numbers + +THE EXAM THINKS THAT 1G = 1000KB +THEY CALL 1024KB = 1 Gibibyte + +2^n is the maximum amount of values, n = the number of bits diff --git a/comp/notes/3 b/comp/notes/3 new file mode 100755 index 0000000..b15a121 --- /dev/null +++ b/comp/notes/3 @@ -0,0 +1,5 @@ +the first half of the lesson was recapping floating point numbers +for a standard value there will always be 1 bit then the decimal point then the rest of the factional value +a standard value will have a ten bit fractional value and a 6 bit exponent (both will be signed) + +second half of the lesson is programming diff --git a/comp/notes/4 b/comp/notes/4 new file mode 100755 index 0000000..b263173 --- /dev/null +++ b/comp/notes/4 @@ -0,0 +1,15 @@ +the os is a tool designed to make the hardware easier to interactive with, it does this via masking the hardware into easier forms, look at /dev/wsmouse0 for an example + +it also needs to make programs easier to write and run, however doing this limits them to the platform they are compiled for + +an os may provide apis (/sys on linux) (/dev on openbsd) which allow talking to the hardware and sending signals much easier + +there will be a vaiety of different ways of interacting with the os, there is a gui (smelly gui), a tui (better gui), and a cli (the right one) + +the os also needs to deal with memory and cpu alication, which ensures the system isn't going to use 100% cpu for a split second while running ls + +a virtual machine (in the sense they want me to know), is a disk image, use doas dd if=/ of=/dev/usb0 to make one + +the os also manages stuff getting writen to the drives, this is via the file system, on linux it will be ext4, btrfs, etc and on windows it will be ntfs or fat 32/64 + +remember that translators and compilers come under this topic as they translate to os specific binary files (see man clang for more) diff --git a/comp/notes/5 b/comp/notes/5 new file mode 100755 index 0000000..497d1d2 --- /dev/null +++ b/comp/notes/5 @@ -0,0 +1,18 @@ +io devices +barcode reader + it shines a light, then more light reflects from the white than the black, then it uses that to read a string + white is 0, black is 1 + barcodes have a product number on the right and a manufacture number on the left + the right hand side codes are writen through a not gate (inversed) +qr codes + the same as a barcode but 2d +digital cameras + they look at how much light enters the lens then depending on its color and brightness it will output a different value + each pixel the camera outputs must have its own small light/color sensor +lazer printer + a negative static charge is put on paper + puts ink down thats atractive to the negative charge +rfid + it sends some radio waves out, then reads the radio waves sent back + some devices require active power, while other can get power from the incoming radio waves + diff --git a/comp/notes/6/archictecture b/comp/notes/6/archictecture new file mode 100755 index 0000000..c770983 --- /dev/null +++ b/comp/notes/6/archictecture @@ -0,0 +1,21 @@ +there are 3 busses, data, control, address +the data carrys data from the cpu +the address carrys mem addresses +the control bus is used to talk to devices about what data to send + +von nueman architecture has all the things (cpu mem io) on the same bus + +harvard architecture has all the things seperateated on different busses, including mem split into program and data + +moddern cpus have a mix of the 2 architectures + +the two each have there own advantges + +von nueman is simpler overall however it can have limiting speeds as all the busses are shared + +harvard is generally faster as it doesnt have to share any busses, however it can be harder to work with as the developer has to specify which but they are sending data too +also the extra wires can make costs higher, however this will only ever effect very large scale production + +speed is determined by things like clock speed, core count and bus width + +a faster cpu may be faster overall, however certan workflows benifit from more cores diff --git a/comp/while/1.py b/comp/while/1.py new file mode 100755 index 0000000..08a4e21 --- /dev/null +++ b/comp/while/1.py @@ -0,0 +1,10 @@ +num = 0 +highest = 0 +lowest = 0 +while num != -1: + num = int(input("num: ")) + if num > highest: + highest = num + if num < lowest: + lowest = num +print("the highest value was",highest,"and the lowest value was",lowest) diff --git a/comp/while/2.py b/comp/while/2.py new file mode 100755 index 0000000..7929862 --- /dev/null +++ b/comp/while/2.py @@ -0,0 +1,13 @@ +import random + +guess = -1 +ans = random.randint(1,100) + +while guess != ans: + guess = int(input("guess: ")) + if guess < ans: + print("higher") + elif guess > ans: + print("lower") + + 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 Binary files differnew file mode 100755 index 0000000..400cc75 --- /dev/null +++ b/comp/work/12/__pycache__/valid.cpython-312.pyc 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 Binary files differnew file mode 100755 index 0000000..8260b96 --- /dev/null +++ b/comp/work/8/ascii 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 Binary files differnew file mode 100755 index 0000000..3ede671 --- /dev/null +++ b/comp/work/8/ascii_word 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 Binary files differnew file mode 100755 index 0000000..66738ce --- /dev/null +++ b/comp/work/8/parity 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=" ") + diff --git a/electronics/notes/1 b/electronics/notes/1 new file mode 100755 index 0000000..c6f9208 --- /dev/null +++ b/electronics/notes/1 @@ -0,0 +1,29 @@ +really simple first lesson, talked about what a current actually is + +also talked about basics of circuits: +eg: + cell long line is posative short line negatie, remeber that a - is short + current flows from posative to negative but electrons themselfs flow negative to posative. + thats being caused by people assuming thing flow one way before mesuring them + conventional current reffers to there posative to negative NOT THE FLOW OF ELECTRONS + +we also did some practical, where we built a circuit with a bulb +we learnt how to use the multi meters +how to: + put one input into the com (common port) and another goes into the coresponding wire you want to use + 10 amp (probably never used) is the far left + mamps is the second from left + common is third from left + voltage is fouth + turn the thing to where it is needed, a wavey line is ac, straight is dc + if working with low volts/amps turn it down to mvolts or mamps + +we also learnt more about the rest of the course +notable bits: + we will start course work in second year + first few weeks is just gonna be gcse recap + then something about digital logic, sounds fun + sheet about that in folder + we will have done some of the second year stuff in year 1 to give us time for course work + +we also joined the teams thing diff --git a/electronics/notes/2 b/electronics/notes/2 new file mode 100755 index 0000000..7a81de2 --- /dev/null +++ b/electronics/notes/2 @@ -0,0 +1,38 @@ +use these to convert to the standard unit +ie: + 1km = 1 x 1000 meter + 1mV = 1 / 1000 volts + +G = giga = x 1,000,000,000 = x10^9 +M = mega = x 1,000,000 = x10^6 +k = kilo = x 1000 = x10^3 +m = milli = / 1000 = x10^-3 +u (funny u (mu)) = micro = / 1,000,000 = x10^-6 +n = nano = / 1,000,000,000 = x10^-9 +p = pico = / 1,000,000,000,000 = x10^-12 + +you can do the inverse of those to convert to a more reasonable scale +ie: + 120,000V = 12kV + 0.15A = 150mA + +first half of the lesson was learning those and touching up on standard form + +second half we are going over current and voltage + +current is the rate of flow of charge, to find the current, i = q/t with i being current, q is culombs and t is time +AMETERS GO IN SERIS + +voltage is the energy tranfered per unit of charge +v = e/q with v being volts, e being energy, and q being culombs +VOLTMETER GO IN PARRALEL + +later on we are doing practical, mesuring voltage with circuit with a bulb or a resistor +plotted the results on a graph, my resistor graph was perfectly liner +and my bulb graph is more similar to a cubic graph + - + / +- +kind of like that + +we looked at a bit of resistance at the end, worksheet work (BRING IT TO THE NEXT LESSON) diff --git a/electronics/notes/3 b/electronics/notes/3 new file mode 100755 index 0000000..7152b8f --- /dev/null +++ b/electronics/notes/3 @@ -0,0 +1,15 @@ +((1/r)+(1/r)+(1/r))^-1 +that is the total resistance of the circuit if it is in parralel +we did this cool practical with a box to see where resistors are +when you have resistors in series the supply voltage is shared un evenly across the resistors +the sum of the voltages across the resistor will add up to the voltage from the power suply +if the resistors are of the same resistance the voltage will be an even split +greater voltage will go across the larger resistor +each component has the has an equal proportion of the total voltage compared to the proportion that the resistor is to the total voltage + +(r1 / rt) = the proportion in restance + +voltage across a componet = (r1 / rt) x VoltageTotal + +kirchoff's first law, is that the current in all parralel branches adds up to the total current +his second law is that the sum of the energy in point equals the sum of potential differences around any loop of a circuit diff --git a/electronics/notes/4 b/electronics/notes/4 new file mode 100755 index 0000000..a6d1ca7 --- /dev/null +++ b/electronics/notes/4 @@ -0,0 +1,10 @@ +the sum of currents into a node = the sum of currents exiting the node - kirchoffs first law +the sum of the emf equals the sum of the potential differences across a loop - kirchoffs second law + +the emf is the voltage across a power supply + +remember that when a wire splits into 2 parralel branches its current splits while the voltage stays the same + +this is because voltage is a mesure of energy per unit of charge, which wouldn't change because each electron has the same charge. +the current splits because its a way of messuring the amount of charge flowing + diff --git a/electronics/notes/5 b/electronics/notes/5 new file mode 100755 index 0000000..a962531 --- /dev/null +++ b/electronics/notes/5 @@ -0,0 +1,24 @@ +mosfet's +(metal oxide semiconducting feild effect transistor) +voltage controled device +has a: +drain equivilant to the collector on a transistor +gate the base +source the emmiter + +no current can flow into the gate + +its just a new kind of transistor for the most part +differences between transistor: + when it is on, it still conducts slightly (about 0.4V) + this is because it has a slight resistance, whereas a transistor does not + the small resistance it has is given the name Rdson (something about resistance when on (r d s on)) + there is a formula for this in the formula sheet + + a mosfet will start to conduct when the input voltage is 3V unless the question says otherwise + + when ploting a graph of a mosfet, with Vin and I at the drain (Id) the gradient of that line is called gm + Id = gm * (Vin - 3) + gm is called the transconductance + + the gm and rdson are propertys of the mosfet diff --git a/maths/MUSTKNOW/cosineRule b/maths/MUSTKNOW/cosineRule new file mode 100755 index 0000000..a57f4f7 --- /dev/null +++ b/maths/MUSTKNOW/cosineRule @@ -0,0 +1,11 @@ +trig rule, used to find missing sides on a triangle + +a^2 = b^2 + c^2 - 2bc cos(A) + +when rearranged can be: + +cos(A) = (b^2 + c^2 - a^2) / (2bc) // use this one when you only have side lengths + +when using this use cos^-1 + +example in folder p1 diff --git a/maths/notes/1 b/maths/notes/1 new file mode 100755 index 0000000..68f5531 --- /dev/null +++ b/maths/notes/1 @@ -0,0 +1,11 @@ +the fist lesson was not a nice time +started with setting up techy stuff, the classroom, outlook +then got straight in with a test + +the test wasnt too bad but everyone else was alot faster, work on speed +cosine rule killed me as well as a large similtanius equation +work on them + +need to chase up teacher on the text book login but have already sent an email so not too worried + +the people next to you seem nice, although quiet as expected diff --git a/maths/notes/2 b/maths/notes/2 new file mode 100755 index 0000000..d37e82c --- /dev/null +++ b/maths/notes/2 @@ -0,0 +1,8 @@ +maths was fine + +just did stuff from the work book (exersise 1d) + +worked on ^x + +todo: + learn the 7 rules of them diff --git a/maths/notes/3 b/maths/notes/3 new file mode 100755 index 0000000..e3ba333 --- /dev/null +++ b/maths/notes/3 @@ -0,0 +1,19 @@ +3rd maths lesson, going well so far, we are working on factorizing in the first half + +i think we will be doing surds in the second half + +the fatorizing is pretty easy overall + +for factorizing things like 4x^2 + 4x + 3, you multiply the first value and the last then find a pair of numbers that adds together to equal the middle value, then put them back in individually and factorise the thing + +surds does not sound fun + +surds arent that bad really, to simplify them split them into 2 factors, one must be a square number +then square root the square number and move it out of the sign, then leave the remaining value + +the lesson was fun, everyone was somewhat interested in the thinkpad, ill have to show them more next lesson +the guy oposite you knows what linux is + +nothing was overly chalenging + + diff --git a/maths/notes/4 b/maths/notes/4 new file mode 100755 index 0000000..757456e --- /dev/null +++ b/maths/notes/4 @@ -0,0 +1,14 @@ +so far so good with maths, todays work was quite hard however + +had to work on some completing the square + +also found out how to solve some weird quadratics + +if something is like x^6+x^3+2 its still a quadratic +to solve it you would say let y = x^3 +then rewrite the equation as y^2+y+2 +then solve with the quadratic formula or factorizing +and then cube root the ans to give it in terms of x for the final anwser + +you can only do that when all the powers line up with something that can be divided to match a quadratic +so x + x^7 + 23 wouldnt work diff --git a/maths/notes/5 b/maths/notes/5 new file mode 100755 index 0000000..e389064 --- /dev/null +++ b/maths/notes/5 @@ -0,0 +1,12 @@ +writing this late and cant really remember what we did +we did some work on completing the square which is never too hard, however i should try and do some more work on it +try and remember how to put something into a completed square form as well as take it out + +x^2 + 6x + 6 +(x + 3)^2 - 3 +method is to half B, then subtract b^2, and add whatever is needed to make sure + c works + +this can be used to find the turning point of the graph, the section in brackets needs to have its sign flipped +this is similar to using factorising to solve a quadratic +the value outside the bracket stays as is +in the example given the turning point would be (-3, -3) @@ -0,0 +1,22 @@ +notes on day 1 + +got the bs with rosile and jazmin +when we got off the bus met jazmines friend, seemed a bit dull +got to collage then sat in libary with ben and rosile +pretty good, maths was not fun but i did it +see maths/notes/1 for more info +got out of maths and went to the libary, touched up on cosine rule, practice is in math/NEEDTOKNOW/cosineRule i think +that makes things feel alittle better +after that did alittle programing and fixed up the broken algorithum from the line game +you should play it to get better +then had electronics, compared to maths alot better, the teacher seems nice enough, +notes on lesson at electronics/notes/1 +got out of collage and walked to the shops, missed the 15:50 will get the 16:50 +currently writing these notes outside ee + +todo things: + chase up math teacher on the text book stuff + learn friends names, there is alex, who is in tutor with you and then the other guy you keep meting, his names not ryan but simailar to ryan + considering working on a project to make these notes easier to go back on + relized it will need ls dir in c so it will be something to work on and home then sshcp to laptop + @@ -0,0 +1,10 @@ +day 2 went well but maths was hard + +need to do more maths revision, but comp sci was easy + +fixed the stupid login thing for maths + +told nick and nyki about tuseday + +made a friend (hanna) dont forget name + @@ -0,0 +1,4 @@ +day 3 was the best so far, electronics was chilled +i learnt the guys name i kept forgeting (its rain but spelt like ryan) +met the person jazmin always says im like, they seem nice +really short day quite good @@ -0,0 +1,7 @@ +oops i forgot to write this one so its late + +day was quite good, no major take backs from it, just that the day happend +we all talked quite alot in maths which was good + +computer science was a bit harder but nothing really that bad, will work on signed binary to hex and denary soon +need to relearn floats because i had them wrong before @@ -0,0 +1,4 @@ +yet another late one but it is what it is, the day was fine + +electronics was enjoyable and i caught up on all the things i missed from tuesday +maths i felt wasnt as good as the previous lesson but was still enjoyable |