Skip to content

Instantly share code, notes, and snippets.

View borislavstoychev's full-sized avatar
💭
💻 Coding....

Borislav Stoychev borislavstoychev

💭
💻 Coding....
View GitHub Profile
from project.animals.birds import Owl, Hen
from project.food import Meat, Vegetable, Fruit
from project.animals.mammals import Tiger
if __name__ == "__main__":
owl = Owl("Pip", 10, 10)
print(owl)
meat = Meat(4)
print(owl.make_sound())
function passValidator(pass) {
let errors = []
function len(pass) {
if (!(pass.length >= 6 && pass.length <= 10))
errors.push("Password must be between 6 and 10 characters")
return pass
}
function checkConsists(pass) {
for (let i = 0; i < pass.length; i++) {
function foo(num) {
let evenSum = 0;
let oddSum = 0;
for (const n of String(num)) {
Number(n) % 2 == 0 ? evenSum += Number(n) : oddSum += Number(n)
}
return ` Odd sum = ${oddSum}, Even sum = ${evenSum}`;
}
console.log(foo(1000435))
let evenSum = 0;
let oddSum = 0;
for (const n of String(num)) {
Number(n) % 2 == 0 ? evenSum += Number(n) : oddSum += Number(n)
}
return ` Odd sum = ${oddSum}, Even sum = ${evenSum}`;
function solve(speed, area) {
speed = Number(speed);
let status;
const areaLimits = {
motorway: 130,
interstate: 90,
city: 50,
residential: 20,
};
function arrManipulations(args) {
let myArr = args
.shift()
.split(" ")
.map(Number)
for (commands of args) {
let [command, firstN, secondN] = commands.split(" ");
firstN = Number(firstN)
secondN = Number(secondN)
switch (command) {
function gladiatorInventory(arr) {
let inventory = arr.shift().split(" ");
const actions = {
Buy: (equipment) => buy(equipment),
Trash: (equipment) => trash(equipment),
Repair: (equipment) => repair(equipment),
Upgrade: (param) => upgrade(param)
};
function buy(eq) {
function bombNums(arr1, arr2) {
let [bomb, power] = arr2
for (let i = 0; i < arr1.length; i++) {
if (arr1[i] === bomb) {
arr1.splice(i - power > 0 ? i - power : 0, power * 2 + 1);
i = 0;
}
}
return arr1.reduce((a, v) => a + v, 0);
function catalogues(arr) {
let catalogue = new Map();
arr.forEach(element => {
[keys, values] = element.split(" : ");
catalogue.set(keys, values)
});
let sorted = Array.from(catalogue.entries())
.sort(([keyA, valueA], [keyB, valueB]) => keyA.localeCompare(keyB));
let result = {};
sorted.forEach(element => {
Part Type Pieces Part Name Part price, lv Part Link
HDD 6 SEAGATE Exos X16 512E/4KN 16TB ST16000NM001G чакам доставка Link
M.2 SSD for plotting 1 Samsung 980 PRO чакам доставка Link
M.2 SSD for OS 1 Samsung 970 EVO Plus 135 Link
Motherboard 1 MSI MAG B550 TOMAHAWK 352 Link
CPU 1 AMD RYZEN 7 3700X 8-Core 3.6 GHz 596 [Link](https://pcmall.bg/%d0%bf%d1%80%d0%be%d1%86%d0%b5%d1%81%d0%be%d1%80-amd-ryzen-7-3700x-8-core-3.6-ghz-4.4-ghz-turbo-36mb-65w-am4-box-amd-am4-r7-ryzen-3