• Stars
    star
    1
  • Language
    JavaScript
  • Created over 2 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Your task is to create a function that does four basic mathematical operations. The function should take three arguments - operation(string/char), value1(number), value2(number). The function should return result of numbers after applying the chosen operation. Examples(Operator, value1, value2) --> output ('+', 4, 7) --> 11 ('-', 15, 18) --> -3 ('*', 5, 5) --> 25 ('/', 49, 7) --> 7

More Repositories

1

codewars-7kyu-Binary-Addition

7kyu Binary Addition Implement a function that adds two numbers together and returns their sum in binary. The conversion can be done before, or after the addition. The binary number returned should be a string. Examples:(Input1, Input2 --> Output (explanation))) 1, 1 --> "10" (1 + 1 = 2 in decimal or 10 in binary) 5, 9 --> "1110" (5 + 9 = 14 in decimal or 1110 in binary)
JavaScript
2
star
2

codewars-7kyu-Highest-and-Lowest

/* 7kyu Highest and Lowest In this little assignment you are given a string of space separated numbers, and have to return the highest and lowest number. Examples highAndLow("1 2 3 4 5"); // return "5 1" highAndLow("1 2 -3 4 5"); // return "5 -3" highAndLow("1 9 3 4 -5"); // return "9 -5" Notes All numbers are valid Int32, no need to validate them. There will always be at least one number in the input string. Output string must be two numbers separated by a single space, and highest number is first
JavaScript
2
star
3

codewars-8kyu-Sum-without-highest-and-lowest-number

8kyu-Sum without highest and lowest number Sum all the numbers of a given array ( cq. list ), except the highest and the lowest element ( by value, not by index! ). The highest or lowest element respectively is a single element at each edge, even if there are more than one with the same value. Mind the input validation. Example { 6, 2, 1, 8, 10 } => 16 { 1, 1, 11, 2, 3 } => 6 Input validation If an empty value ( null, None, Nothing etc. ) is given instead of an array, or the given array is an empty list or a list with only 1 element, return 0.
JavaScript
2
star
4

codewars-6kyu_Playing-with-digits

/* 6kyu-playing with digits Some numbers have funny properties. For example: 89 --> 8¹ + 9² = 89 * 1 695 --> 6² + 9³ + 5⁴= 1390 = 695 * 2 46288 --> 4³ + 6⁴+ 2⁵ + 8⁶ + 8⁷ = 2360688 = 46288 * 51 Given a positive integer n written as abcd... (a, b, c, d... being digits) and a positive integer p we want to find a positive integer k, if it exists, such that the sum of the digits of n taken to the successive powers of p is equal to k * n. In other words: Is there an integer k such as : (a ^ p + b ^ (p+1) + c ^(p+2) + d ^ (p+3) + ...) = n * k If it is the case we will return k, if not return -1. Note: n and p will always be given as strictly positive integers.
JavaScript
2
star
5

codewars-7kyu-is-this-a-triangle

/* 7kyu Is this a triangle? Implement a function that accepts 3 integer values a, b, c. The function should return true if a triangle can be built with the sides of given length and false in any other case. (In this case, all triangles must have surface greater than 0 to be accepted).
JavaScript
1
star
6

codewars-8kyu-Reversed-Strings

/* 8 kyu Reversed Strings Complete the solution so that it reverses the string passed into it. 'world' => 'dlrow' 'word' => 'drow'
JavaScript
1
star
7

codewars-7kyu_string-ends-with

/* 7 kyu String ends with? Complete the solution so that it returns true if the first argument(string) passed in ends with the 2nd argument (also a string). Examples: solution('abc', 'bc') // returns true solution('abc', 'd') // returns false
JavaScript
1
star
8

codewars-8kyu-Simple-multiplication

/* 8kyu simple multiplication This kata is about multiplying a given number by eight if it is an even number and by nine otherwise.
JavaScript
1
star
9

Project2

Treehouse project2
HTML
1
star
10

my-portfolio

its a showcase of my skills and my new portfolio
CSS
1
star
11

codewars-7-kyu-Printer-errors-one-line

codewars-7-kyu-Printer-errors-one-line solution
JavaScript
1
star
12

Shuffler

Made a shuffler
JavaScript
1
star
13

codewars-8kyu-returning-strings

8kyu Returning Strings Make a function that will return a greeting statement that uses an input; your program should return, "Hello, <name> how are you doing today?". [Make sure you type the exact thing I wrote or the program may not execute properly]
JavaScript
1
star
14

codewars-8kyu-Can-we-divide-it

8kyu can we divide it? Your task is to create the functionisDivideBy (or is_divide_by) to check if an integer number is divisible by both integers a and b. A few cases: (-12, 2, -6) -> true (-12, 2, -5) -> false (45, 1, 6) -> false (45, 5, 15) -> true (4, 1, 4) -> true (15, -5, 3) -> true
JavaScript
1
star
15

codewars-7kyu-Sum-of-two-lowest-positive-integers

/* 7kyu Sum of two lowest positive integers Create a function that returns the sum of the two lowest positive numbers given an array of minimum 4 positive integers. No floats or non-positive integers will be passed. For example, when an array is passed like [19, 5, 42, 2, 77], the output should be 7. [10, 343445353, 3453445, 3453545353453] should return 3453455.
JavaScript
1
star
16

codewars-8kyu-Invert-values

8kyu ınvert values Given a set of numbers, return the additive inverse of each. Each positive becomes negatives, and the negatives become positives. invert([1,2,3,4,5]) == [-1,-2,-3,-4,-5] invert([1,-2,3,-4,5]) == [-1,2,-3,4,-5] invert([]) == [] You can assume that all values are integers. Do not mutate the input array/list.
JavaScript
1
star
17

codewars-6-kyu-take-a-ten-minutes-walk

You live in the city of Cartesia where all roads are laid out in a perfect grid. You arrived ten minutes too early to an appointment, so you decided to take the opportunity to go for a short walk. The city provides its citizens with a Walk Generating App on their phones -- everytime you press the button it sends you an array of one-letter strings representing directions to walk (eg. ['n', 's', 'w', 'e']). You always walk only a single block for each letter (direction) and you know it takes you one minute to traverse one city block, so create a function that will return true if the walk the app gives you will take you exactly ten minutes (you don't want to be early or late!) and will, of course, return you to your starting point. Return false otherwise. Note: you will always receive a valid array (string in COBOL) containing a random assortment of direction letters ('n', 's', 'e', or 'w' only). It will never give you an empty array (that's not a walk, that's standing still!).
JavaScript
1
star
18

codewars-8kyu-century-from-year

/* 8kyu-Century From Year Introduction The first century spans from the year 1 up to and including the year 100, the second century - from the year 101 up to and including the year 200, etc. Task Given a year, return the century it is in. Examples 1705 --> 18 1900 --> 19 1601 --> 17 2000 --> 20
JavaScript
1
star
19

codewars-8kyu-Return-Negative

8kyu Return Negative In this simple assignment you are given a number and have to make it negative. But maybe the number is already negative? Examples makeNegative(1); // return -1 makeNegative(-5); // return -5 makeNegative(0); // return 0 makeNegative(0.12); // return -0.12 Notes The number can be negative already, in which case no change is required. Zero (0) is not checked for any specific sign. Negative zeros make no mathematical sense.
JavaScript
1
star
20

8-kyu-remove-first-and-last-character

/* 8kyu Remove First and Last Character It's pretty straightforward. Your goal is to create a function that removes the first and last characters of a string. You're given one parameter, the original string. You don't have to worry with strings with less than two characters.
JavaScript
1
star
21

codewars-8kyu-A-Needle-in-the-Haystack

/* 8kyu A Needle in the Haystack Can you find the needle in the haystack? Write a function findNeedle() that takes an array full of junk but containing one "needle" After your function finds the needle it should return a message (as a string) that says: "found the needle at position " plus the index it found the needle, so: findNeedle(['hay', 'junk', 'hay', 'hay', 'moreJunk', 'needle', 'randomJunk']) should return "found the needle at position 5"
JavaScript
1
star
22

codewars-7kyu-Anagram-Detection

7kyu- Anagram Detection An anagram is the result of rearranging the letters of a word to produce a new word (see wikipedia). Note: anagrams are case insensitive Complete the function to return true if the two arguments given are anagrams of each other; return false otherwise. Examples "foefet" is an anagram of "toffee" "Buckethead" is an anagram of "DeathCubeK"
JavaScript
1
star
23

codewars-kyu7-isograms

An isogram is a word that has no repeating letters, consecutive or non-consecutive. Implement a function that determines whether a string that contains only letters is an isogram. Assume the empty string is an isogram. Ignore letter case. Example: (Input --> Output) "Dermatoglyphics" --> true "aba" --> false "moOse" --> false (ignore letter case)
JavaScript
1
star
24

codewars-7-kyu-two-to-one

/* 7 kyu-Two to One Take 2 strings s1 and s2 including only letters from ato z. Return a new sorted string, the longest possible, containing distinct letters - each taken only once - coming from s1 or s2. Examples: a = "xyaabbbccccdefww" b = "xxxxyyyyabklmopq" longest(a, b) -> "abcdefklmopqwxy" a = "abcdefghijklmnopqrstuvwxyz" longest(a, a) -> "abcdefghijklmnopqrstuvwxyz"
JavaScript
1
star
25

codewars6-6kyu-Array-diff

/* 6kyu-Array.diff Your goal in this kata is to implement a difference function, which subtracts one list from another and returns the result. It should remove all values from list a, which are present in list b keeping their order. arrayDiff([1,2],[1]) == [2] If a value is present in b, all of its occurrences must be removed from the other: arrayDiff([1,2,2,2,3],[2]) == [1,3]
JavaScript
1
star
26

30daychallangeday1

JavaScript
1
star
27

codewars-7-kyu-Ones-and-Zeros

/*7 kyu Ones and Zeros Given an array of ones and zeroes, convert the equivalent binary value to an integer. Eg: [0, 0, 0, 1] is treated as 0001 which is the binary representation of 1. Examples: Testing: [0, 0, 0, 1] ==> 1 Testing: [0, 0, 1, 0] ==> 2 Testing: [0, 1, 0, 1] ==> 5 Testing: [1, 0, 0, 1] ==> 9 Testing: [0, 0, 1, 0] ==> 2 Testing: [0, 1, 1, 0] ==> 6 Testing: [1, 1, 1, 1] ==> 15 Testing: [1, 0, 1, 1] ==> 11 However, the arrays can have varying lengths, not just limited to 4.
JavaScript
1
star
28

codewars-8kyu-Holiday-VIII-Duty-Free

8kyu-Holiday VIII - Duty Free The purpose of this kata is to work out just how many bottles of duty free whiskey you would have to buy such that the saving over the normal high street price would effectively cover the cost of your holiday. You will be given the high street price (normPrice), the duty free discount (discount) and the cost of the holiday. For example, if a bottle cost £10 normally and the discount in duty free was 10%, you would save £1 per bottle. If your holiday cost £500, the answer you should return would be 500. All inputs will be integers. Please return an integer. Round down.
JavaScript
1
star
29

codewars-7kyu-Round-up-to-the-next-multiple-of-5

7kyu -Round up to the next multiple of 5 Given an integer as input, can you round it to the next (meaning, "higher") multiple of 5? Examples: input: output: 0 -> 0 2 -> 5 3 -> 5 12 -> 15 21 -> 25 30 -> 30 -2 -> 0 -5 -> -5 etc. Input may be any positive or negative integer (including 0). You can assume that all inputs are valid integers.
JavaScript
1
star
30

patika-hafta6-sql-odev7

sql ödev 7
1
star
31

patika-hafta6-SQL-Temelleri-II-devleri

SQL Temelleri-II Ödevleri
1
star
32

codewars-7-kyu-Categorize-New-Member

/* 7kyu Categorize New Member The Western Suburbs Croquet Club has two categories of membership, Senior and Open. They would like your help with an application form that will tell prospective members which category they will be placed. To be a senior, a member must be at least 55 years old and have a handicap greater than 7. In this croquet club, handicaps range from -2 to +26; the better the player the lower the handicap. Input Input will consist of a list of pairs. Each pair contains information for a single potential member. Information consists of an integer for the person's age and an integer for the person's handicap. Output Output will consist of a list of string values (in Haskell and C: Open or Senior) stating whether the respective member is to be placed in the senior or open category. Example input = [[18, 20], [45, 2], [61, 12], [37, 6], [21, 21], [78, 9]] output = ["Open", "Open", "Senior", "Open", "Open", "Senior"]
JavaScript
1
star
33

codewars-8kyu-Keep-Hydrated

/* 8 kyu Keep Hydrated! Nathan loves cycling. Because Nathan knows it is important to stay hydrated, he drinks 0.5 litres of water per hour of cycling. You get given the time in hours and you need to return the number of litres Nathan will drink, rounded to the smallest value. For example: time = 3 ----> litres = 1 time = 6.7---> litres = 3 time = 11.8--> litres = 5
JavaScript
1
star
34

codewars-7-kyu-Youre-a-square

7 kyu You're a square! A square of squares You like building blocks. You especially like building blocks that are squares. And what you even like more, is to arrange them into a square of square building blocks! However, sometimes, you can't arrange them into a square. Instead, you end up with an ordinary rectangle! Those blasted things! If you just had a way to know, whether you're currently working in vain… Wait! That's it! You just have to check if your number of building blocks is a perfect square. Task Given an integral number, determine if it's a square number: In mathematics, a square number or perfect square is an integer that is the square of an integer; in other words, it is the product of some integer with itself. The tests will always use some integral number, so don't worry about that in dynamic typed languages. Examples -1 => false 0 => true 3 => false 4 => true 25 => true 26 => false
JavaScript
1
star
35

codewars-7kyu-Number-of-People-in-the-Bus

7kyu Number of People in the Bus There is a bus moving in the city, and it takes and drop some people in each bus stop. You are provided with a list (or array) of integer pairs. Elements of each pair represent number of people get into bus (The first item) and number of people get off the bus (The second item) in a bus stop. Your task is to return number of people who are still in the bus after the last bus station (after the last array). Even though it is the last bus stop, the bus is not empty and some people are still in the bus, and they are probably sleeping there :D Take a look on the test cases. Please keep in mind that the test cases ensure that the number of people in the bus is always >= 0. So the return integer can't be negative. The second value in the first integer array is 0, since the bus is empty in the first bus stop.
JavaScript
1
star
36

codewars-8kyu-Grasshopper-Grade-book

codewars100- 8kyu- Grasshopper - Grade book Grade book Complete the function so that it finds the average of the three scores passed to it and returns the letter value associated with that grade.
JavaScript
1
star
37

codewars-8kyu-Is-he-gonna-survive

A hero is on his way to the castle to complete his mission. However, he's been told that the castle is surrounded with a couple of powerful dragons! each dragon takes 2 bullets to be defeated, our hero has no idea how many bullets he should carry.. Assuming he's gonna grab a specific given number of bullets and move forward to fight another specific given number of dragons, will he survive? Return True if yes, False otherwise :)
JavaScript
1
star
38

codewars-7-kyu-Printer-errors

/* 7kyu Printer Errors In a factory a printer prints labels for boxes. For one kind of boxes the printer has to use colors which, for the sake of simplicity, are named with letters from a to m. The colors used by the printer are recorded in a control string. For example a "good" control string would be aaabbbbhaijjjm meaning that the printer used three times color a, four times color b, one time color h then one time color a... Sometimes there are problems: lack of colors, technical malfunction and a "bad" control string is produced e.g. aaaxbbbbyyhwawiwjjjwwm with letters not from a to m. You have to write a function printer_error which given a string will return the error rate of the printer as a string representing a rational whose numerator is the number of errors and the denominator the length of the control string. Don't reduce this fraction to a simpler expression. The string has a length greater or equal to one and contains only letters from ato z. Examples: s="aaabbbbhaijjjm" printer_error(s) => "0/14" s="aaaxbbbbyyhwawiwjjjwwm" printer_error(s) => "8/22"
JavaScript
1
star
39

codewars-7-kyu-Friend-or-Foe

Make a program that filters a list of strings and returns a list with only your friends name in it. If a name has exactly 4 letters in it, you can be sure that it has to be a friend of yours! Otherwise, you can be sure he's not... Ex: Input = ["Ryan", "Kieran", "Jason", "Yous"], Output = ["Ryan", "Yous"] i.e. friend ["Ryan", "Kieran", "Mark"] `shouldBe` ["Ryan", "Mark"] Note: keep the original order of the names in the output.
JavaScript
1
star