Skip to content

xhanak2/CodeWars-Python

Repository files navigation

CodeWars

Duplicate_encode

The goal of this exercise is to convert a string to a new string where each character in the new string is "(" if that character appears only once in the original string, or ")" if that character appears more than once in the original string. Ignore capitalization when determining if a character is a duplicate.

Examples "din" => "(((" "recede" => "()()()" "Success" => ")())())" "(( @" => "))(("

DNA

In DNA strings, symbols "A" and "T" are complements of each other, as "C" and "G". You have function with one side of the DNA (string, except for Haskell); you need to get the other complementary side. DNA strand is never empty or there is no DNA at all (again, except for Haskell). DNA_strand ("ATTGC") # return "TAACG" DNA_strand ("GTAT") # return "CATA"

Printer Errors

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" error_printer(s) => "0/14" s="aaaxbbbbyyhwawiwjjjwwm" error_printer(s) => "8/22"

Vowels

Trolls are attacking your comment section! A common way to deal with this situation is to remove all of the vowels from the trolls' comments, neutralizing the threat. Your task is to write a function that takes a string and return a new string with all vowels removed. For example, the string "This website is for losers LOL!" would become "Ths wbst s fr lsrs LL!". Note: for this kata y isn't considered a vowel.

Sum of 2 lowest numbers

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.

Vasya-Clerk

The new "Avengers" movie has just been released! There are a lot of people at the cinema box office standing in a huge line. Each of them has a single 100, 50 or 25 dollar bill. An "Avengers" ticket costs 25 dollars. Vasya is currently working as a clerk. He wants to sell a ticket to every single person in this line. Can Vasya sell a ticket to every person and give change if he initially has no money and sells the tickets strictly in the order people queue? Return YES, if Vasya can sell a ticket to every person and give change with the bills he has at hand at that moment. Otherwise return NO.

Consecutive Fib numbers

There is a given number and you have to find two consecutive Fibonacci numbers f1 and f2 where f1*f2=given number. If exist return true if not false

Bouncing balls

The ball is falling from high h and bounce with parametre bounce. How many times is visible from window in height windows

String of Names (Bart, Lisa & Maggie)

Return: a string formatted as a list of names separated by commas except for the last two names, which should be separated by an ampersand.

Int To Romans

Convert integer to Romans

Duration in seconds To Human Speach

COnvert integer(seconds to human readable format. Ex.4 years, 66 days, 13 hours, 40 minutes and 30 seconds

Observed PIN

Variations of PINs on keypad (like PIN with error posibility)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages