codewars_python_solutions
codewars_python_solutions copied to clipboard
My CodeWars solutions in Python.
CodeWars Python Solutions
Important! : These solutions for education purpose only. Don't directly use them on Codewars katas. Create your own solutions to learn more.
4kyu Katas
| Kata(s) | Solution(s) | Subject | CW Link |
|---|---|---|---|
| Human readable duration format | 1 | str, format, time |
link |
| Strip Comments | 2 | str, format |
link |
5kyu Katas
| Kata(s) | Solution(s) | Subject | CW Link |
|---|---|---|---|
| First non-repeating character | 1 | str, search |
link |
| Greed is Good | 1 | int, array, dict, list, hashmap |
link |
| Human Readable Time | 2 | str, format, time |
link |
| Largest product in a series | 1 | int, math |
link |
| Moving Zeros To The End | 1 | array, list, sort |
link |
| Not very secure | 2 | str, valid, data types |
link |
| Pete, the baker | 1 | hashmap, dict, data types |
link |
| Scramblies | 1 | str, set, data types |
link |
| Simple Pig Latin | 1 | str, format |
link |
| String incrementer | 1 | str, format, regex |
link |
| Where my anagrams at? | 2 | str, array, list, anagram |
link |
| The Hashtag Generator | 2 | str, format |
link |
6kyu Katas
| Kata(s) | Solution(s) | Subject | CW Link |
|---|---|---|---|
| +1 Array | 1 | array, list, data types |
link |
| Are you available? | 1 | array, list, time |
link |
| Array.diff | 2 | array, list, data types |
link |
| Arrh, grabscrab! | 2 | str, array, list, dict, search, data types |
link |
| Bit Counting | 1 | int, binary, data types |
link |
| Break camelCase | 1 | str, format, data types |
link |
| CamelCase Method | 2 | str, format, data types |
link |
| Character with longest consecutive repetition | 1 | str, format, list, array |
link |
| Christmas tree | 1 | str, format, list, array |
link |
| Convert string to camel case | 2 | str, format, data types |
link |
| Count characters in your string | 1 | str, dict, hashmap, data types |
link |
| Count letters in string | 2 | str, dict, hashmap, data types |
link |
| Count the smiley faces! | 1 | str, array, list, data types |
link |
| Counting Duplicates | 1 | str, dict, hashmap, data types |
link |
| Create Phone Number | 2 | str, format, array, list, data types |
link |
| Dashatize it | 2 | int, str, format |
link |
| Decode the Morse code | 1 | int, str, format, list, array, dict, hashmap |
link |
| Delete occurrences of an element if it occurs more than n times | 1 | format, array, list, sort |
link |
| Does my number look big in this? | 1 | int, math |
link |
| Duplicate Encoder | 1 | str, format, array, list |
link |
| Drunk friend | 1 | str, format, decode |
link |
| Easy Balance Checking | 1 | str, format, list, array |
link |
| Find the missing letter | 1 | str, array, list |
link |
| Find the Nexus of the Codewars Universe | 1 | dict, hashmap |
link |
| Find the odd int | 1 | array, list, search |
link |
| Find The Parity Outlier | 1 | array, list, search |
link |
| Find the unique number | 1 | array, list, int |
link |
| Format a string of names like 'Bart, Lisa & Maggie' | 1 | str, dict, hashmap, format |
link |
| Get recursion limit | 1 | recursion |
link |
| Highest Scoring Word | 1 | str, array, list |
link |
| IP Validation | 2 | str, int, array, list, format |
link |
| Meeting | 2 | str, array, list, format |
link |
| Mexican Wave | 1 | str, array, list, format |
link |
| More Zeros than Ones | 1 | str, binary, array, list, sort |
link |
| Mutual Recursion | 1 | recursion, math |
link |
| New Cashier Does Not Know About Space or Shift | 1 | str, array, list, sort |
link |
| Pyramid Array | 1 | str, array, list |
link |
| Remove the parentheses | 1 | str, format, regex |
link |
| Replace With Alphabet Position | 1 | str, array, list, sort |
link |
| Replacement | 2 | int, array, list, sort |
link |
| Sequence convergence | 1 | int, array, list, count |
link |
| Simplify the number! | 1 | str, int, format |
link |
| Sort the odd | 1 | int, array, list, sort |
link |
| Split Strings | 1 | str, array, list |
link |
| String array duplicates | 1 | str, array, list, format |
link |
| String Breakers | 2 | str, array, list, format |
link |
| Stop gninnipS My sdroW! | 1 | str, array, list, format |
link |
| Sum of a Sequence (Hard-Core Version) | 2 | str, array, list, math |
link |
| Sum of Digits / Digital Root | 2 | int, math |
link |
| Sums of Parts | 2 | int, array, list |
link |
| Take a Number And Sum Its Digits Raised To The Consecutive Powers And ....¡Eureka!! | 2 | int, array, list, sort |
link |
| The Vowel Code | 2 | str |
link |
| Title Case | 1 | str, format |
link |
| Tracking Sums in a Process | 2 | list, array |
link |
| Turn String Input into Hash | 1 | list, array, str, format, dict, hashmap |
link |
| Unique In Order | 1 | str, array, list, sort |
link |
| Upside down numbers | 1 | str, array, list, dict, hashmap |
link |
| What will be the odd one out? | 2 | str, array, list, dict, sort |
link |
| Which are in? | 1 | str, array, list |
link |
| Write Number in Expanded Form | 1 | str, int, format |
link |
| Your order, please | 2 | str, format |
link |
7kyu Katas
| Kata(s) | Solution(s) | Subject | CW Link |
|---|---|---|---|
| Anagram Detection | 2 | str, anagram |
link |
| Are the numbers in order? | 1 | str, sort |
link |
| ASCII letters from Number | 1 | str, format, ascii, array, list |
link |
| Balanced Number (Special Numbers Series # 1 ) | 3 | int, math |
link |
| Basic Sequence Practice | 1 | int, numbers, math, arithmetic, list, array |
link |
| Beginner Series # 3 Sum of Numbers | 1 | int, math |
link |
| Building Strings From a Hash | 1 | str, dict, hashmap, sort |
link |
| Calculate Meal Total | 1 | int, float, math |
link |
| Categorize New Member | 1 | str, array, list |
link |
| Ce-s-r-d Strings | 1 | str, format, list, array |
link |
| Char Code Calculation | 1 | str, array, list, arithmetic |
link |
| char_to_ascii | 1 | str, dict, hashmap |
link |
| Check digit | 1 | str, int, index |
link |
| Colour Association | 1 | str, dict, array, hashmap, list |
link |
| Coloured Triangles | 1 | str, format, control flow |
link |
| Combine objects | 1 | dict, hashmap |
link |
| Complete Series | 1 | list, array |
link |
| Complete The Pattern # 1 | 1 | array, list, str |
link |
| Convert boolean values to strings 'Yes' or 'No' | 1 | str, bool |
link |
| Convert Hash To An Array | 1 | array, list, dict, hashmap |
link |
| Count the divisors of a number | 1 | int, math |
link |
| Credit Card Mask | 1 | str, hashmap |
link |
| Descending Order | 1 | int, array, str, list, sort |
link |
| Dictionary from two lists | 2 | dict, hashmap, list, array |
link |
| Disemvowel Trolls | 2 | array, str, list |
link |
| Elevator Distance | 2 | int, array, list |
link |
| Exes and Ohs | 2 | str |
link |
| Find all occurrences of an element in an array | 2 | str |
link |
| Find the capitals | 2 | str, array, list |
link |
| Find the divisors! | 2 | array, list |
link |
| Find The Duplicated Number in a Consecutive Unsorted List | 1 | array, list |
link |
| Find the middle element | 1 | array, list |
link |
| Find the stray number | 1 | array, list |
link |
| Fizz Buzz | 1 | array, list |
link |
| Form The Largest | 1 | str, array, list |
link |
| Form The Minimum | 2 | str, array, list, dict, hashmap |
link |
| Four/Seven | 1 | dict, hashmap |
link |
| Frequency sequence | 1 | array, list, format, dict, hashmap |
link |
| Friend or Foe? | 1 | array, list |
link |
| Get the Middle Character | 1 | str, array, list |
link |
| Help Bob count letters and digits | 1 | str,array, list |
link |
| Hex Hash Sum | 1 | str,array, list, format |
link |
| Highest and Lowest | 1 | str,array, list |
link |
| How much will you spend? | 1 | array, list, dict, hashmap |
link |
| HTML Generator | 2 | str, format |
link |
| Inverting a Hash | 1 | dict, hashmap |
link |
| Is this a triangle? | 1 | int, math |
link |
| Isograms | 2 | str, array, list, dict, hashmap |
link |
| Jaden Casing Strings | 1 | str, format |
link |
| Keep the Order | 1 | int, sort, numbers, array, list |
link |
| Largest 5 digit number in a series | 1 | int, sort, numbers, array, list |
link |
| Largest Elements | 1 | int, sort, numbers, array, list |
link |
| Largest pair sum in array | 1 | array, list, sort |
link |
| List Filtering | 1 | str, int, sort, numbers, array, list |
link |
| Make a function that does arithmetic! | 1 | str, int, numbers, arithmetic |
link |
| Maximum Multiple | 2 | int, numbers, arithmetic, list, array |
link |
| Most sales | 1 | int, numbers, arithmetic, list, array |
link |
| Most valuable character | 1 | str, dict, hashmap, list, array, lambda |
link |
| Moves in squared strings (I) | 1 | str, sort, list, array |
link |
| Mumbling | 1 | str, format, list, array |
link |
| My Languages | 1 | dict, hashmap, list, array, sort, lambda |
link |
| Naughty or Nice | 1 | str, dict, hashmap, json |
link |
| No Loops 2 - You only need one | 1 | boolean, int, numbers |
link |
| Number Of Occurrences | 1 | int, numbers, list, array, search |
link |
| Number of People in the Bus | 1 | int, numbers, list, array |
link |
| Number to digit tiers | 1 | str, format, int, numbers, list, array |
link |
| Numbers in strings | 1 | str, format int, numbers, list, array |
link |
| Odd or Even? | 1 | int, numbers, list, array |
link |
| Ones and Zeros | 1 | int, numbers, list, array, binary |
link |
| Ordering the words! | 1 | str, sort, list, array |
link |
| Over The Road | 1 | math |
link |
| Pandemia | 1 | str |
link |
| Parts of a list | 2 | str, link, array, tuple |
link |
| Person Class Bug | 1 | class, oop, str |
link |
| Player Contact Manager | 1 | dict, hashmap, json, list, array |
link |
| Polydivisible Numbers | 2 | int, numbers, arithmetic |
link |
| Populate hash with array keys and default value | 2 | dict, hashmap, list, array, json |
link |
| Previous multiple of three | 3 | arithmetic, list, array |
link |
| Product Of Maximums Of Array (Array Series # 2) | 1 | list, array |
link |
| Re-organize the weapons! | 1 | dict, hashmap, format |
link |
| Recursion 101 | 1 | recursion, math |
link |
| Refactored Greeting | 1 | str, class, oop |
link |
| Regexp Basics - is it a vowel? | 1 | str |
link |
| Remove anchor from URL | 3 | str, search, format |
link |
| Remove duplicate words | 2 | str, array, list, sort |
link |
| Remove the minimum | 1 | int, numbers, list, array |
link |
| Replace all items | 1 | str, format, int, numbers, list, array |
link |
| Responsible Drinking | 1 | str, format, int, numbers, list, array |
link |
| Return the closest number multiple of 10 | 2 | int, numbers, arithmetic |
link |
| Reverse a Number | 1 | str, int, numbers, sort |
link |
| Reverse words | 1 | str, list, array, format |
link |
| Row Weights | 3 | list, array |
link |
| Search for letters | 1 | list, array, format, str |
link |
| Selective fear of numbers | 1 | str, control flow, numbers, int |
link |
| Shortest Word | 1 | str, list, array |
link |
| Simple consecutive pairs | 1 | list, array, loops, counter |
link |
| Square Every Digit | 1 | int, numbers, arithmetic |
link |
| Sort array by string length | 3 | str, list, array, sort |
link |
| Sort Out The Men From Boys | 2 | list, array, set, sort, lambda |
link |
| Sorting Dictionaries | 1 | list, array, tuple, dict, hashmap, sort, lambda |
link |
| Special Number (Special Numbers Series # 5) | 2 | int, number, list, array |
link |
| String ends with? | 1 | str, search |
link |
| String matchup | 1 | array, list, count |
link |
| STRONGN Strong Number (Special Numbers Series # 2) | 1 | int, numbers, list, array |
link |
| Sum it continuously | 1 | int, arithmetic, list, array |
link |
| Sum of angles | 1 | int, numbers, geometry |
link |
| Sum of Minimums! | 2 | int, numbers, list, array |
link |
| Sum of a sequence | 2 | int, numbers, arithmetic, list, array |
link |
| Sum of two lowest positive integers | 1 | int, numbers, arithmetic, list, array |
link |
| Summing a number's digits | 1 | int, numbers, arithmetic, list, array |
link |
| Summy | 1 | str, int, numbers, arithmetic, list, array |
link |
| Swap items in a dictionary | 1 | dict, hashmap |
link |
| Testing 1-2-3 | 1 | str, list, array, format |
link |
| The highest profit wins! | 1 | str, list, array |
link |
| Thinkful - Dictionary Drills: User contacts | 1 | dict, hashmap, list, array |
link |
| Triangle area | 2 | math, str, format, list, array |
link |
| Two Oldest Ages | 1 | int, numbers, list, array, sort |
link |
| Two to One | 1 | str, format, list, array, sort, set |
link |
| Unique string characters | 1 | str, format, list, array |
link |
| "Very Even" Numbers | 2 | int, numbers, arithmetic |
link |
| Vowel Count | 2 | str, search, list, array |
link |
| What time is it? | 1 | str, format, time |
link |
| Which triangle is that? | 1 | math, tuple, dict, hashmap |
link |
| Words to sentence | 1 | str, list, array, format |
link |
| Working with Dictionaries | 3 | dict, hashmap, list, array |
link |
8kyu Katas
| Kata(s) | Solution(s) | Subject | CW Link |
|---|---|---|---|
| A Needle in the Haystack | 1 | str, search, list, array |
link |
| Abbreviate a Two Word Name | 1 | str, format, list, array |
link |
| All Star Code Challenge # 18 | 1 | str |
link |
| altERnaTIng cAsE <=> ALTerNAtiNG CaSe | 1 | str, format, list, array |
link |
| Are You Playing Banjo? | 1 | str, format |
link |
| Array plus array | 1 | int, numbers, list, array |
link |
| Basic Mathematical Operations | 1 | dict, hashmap, int, numbers, arithmetic |
link |
| Beginner - Reduce but Grow | 1 | int, numbers, arithmetic, list, array |
link |
| Beginner Series # 1 School Paperwork | 1 | int, numbers, arithmetic |
link |
| Beginner Series # 2 Clock | 2 | int, numbers, arithmetic, time |
link |
| Calculate average | 1 | list, array |
link |
| Calculate BMI | 2 | int, numbers, control flow |
link |
| Century From Year | 2 | int, numbers, control flow |
link |
| Classy Classes | 1 | class, oop, str, format |
link |
| Convert a Number to a String! | 1 | str, int |
link |
| Convert number to reversed array of digits | 2 | str, int, numbers, list, array |
link |
| Convert a string to an array | 1 | str, list, array |
link |
| Correct the mistakes of the character recognition software | 3 | str, format |
link |
| Convert a String to a Number! | 1 | str, int, numbers |
link |
| Count by X | 1 | int, numbers, list, array |
link |
| Count Odd Numbers below n | 1 | int, numbers, arithmetic |
link |
| Count of positives / sum of negatives | 1 | int, numbers, list, array |
link |
| Count the Monkeys! | 1 | int, numbers, list, array |
link |
| Do I get a bonus? | 2 | str, format |
link |
| Double Char | 1 | str, format, list, array |
link |
| Enumerable Magic # 25 - Take the First N Elements | 1 | list, array |
link |
| Even or Odd | 1 | int, numbers, arithmetic |
link |
| Exclamation marks series #11: Replace all vowel to exclamation mark in the sentence | 1 | str, format |
link |
| Filling an array (part 1) | 2 | int, numbers, list, array |
link |
| Find Maximum and Minimum Values of a List | 1 | list, array |
link |
| Find numbers which are divisible by given number | 1 | int, numbers, list, array |
link |
| Find the Difference in Age between Oldest and Youngest Family Members | 1 | int, numbers |
link |
| Find the first non-consecutive number | 1 | int, numbers, list, array |
link |
| Find the smallest integer in the array | 1 | int, numbers, list, array |
link |
| Function 1 - hello world | 1 | str |
link |
| get character from ASCII Value | 1 | str, ascii |
link |
| Get the mean of an array | 1 | list, array |
link |
| Grasshopper - Basic Function Fixer | 1 | function, arithmetic |
link |
| Grasshopper - Check for factor | 1 | str |
link |
| Grasshopper - Grade book | 1 | str, int, numbers, control flow |
link |
| Grasshopper - Messi goals function | 1 | int, numbers, arithmetic |
link |
| Grasshopper - Summation | 1 | int, numbers, list, array, arithmetic |
link |
| Gravity Flip | 2 | int, numbers, list, array, sort |
link |
| Hello, Name or World! | 1 | str, format |
link |
| How good are you really? | 1 | int, numbers, arithmetic |
link |
| I love you, a little , a lot, passionately ... not at all | 1 | str, list, array |
link |
| If you can't sleep, just count sheep!! | 1 | str, format, loops |
link |
| Invert values | 1 | int, numbers, list, array |
link |
| Is he gonna survive? | 1 | int, numbers, arithmetic |
link |
| Is the string uppercase? | 1 | str, format |
link |
| Jenny's secret message | 1 | str, format, control flow |
link |
| Job Matching # 1 | 2 | dict, hashmap, math, arithmetic |
link |
| Incorrect division method | 1 | int, float, numbers, arithmetic |
link |
| Is n divisible by x and y? | 1 | int, numbers, arithmetic |
link |
| Keep Hydrated! | 1 | int, numbers, arithmetic |
link |
| Keep up the hoop | 1 | str, int, control flow |
link |
| L1: Bartender, drinks! | 1 | str, dict, hashmap, control flow |
link |
| L1: Set Alarm | 1 | str, control flow |
link |
| Leonardo Dicaprio and Oscars | 1 | str, int, control flow |
link |
| MakeUpperCase | 1 | str, format |
link |
| Multiply | 1 | int, numbers, arithmetic |
link |
| N-th Power | 1 | list, array |
link |
| No Loops 2 - You only need one | 1 | list, array |
link |
| No zeros for heros | 1 | str, int, format, loops |
link |
| noobCode 01: SUPERSIZE ME.... or rather, this integer! | 2 | str, int, numbers, sort, list, array |
link |
| Opposite number | 1 | int, numbers |
link |
| Palindrome Strings | 1 | str, palindrome |
link |
| Parse nice int from char problem | 1 | str, int |
link |
| Pizza Comparison | 1 | int, math, arithmetic |
link |
| Polish alphabet | 1 | str, format, dict, hashmap, list, array |
link |
| Quarter of the year | 1 | list, array dict, hashmap, math |
link |
| Regex count lowercase letters | 2 | str, count |
link |
| Remove exclamation marks | 1 | str, format |
link |
| Remove First and Last Character | 1 | str, format |
link |
| Remove String Spaces | 1 | str, format |
link |
| Removing Elements | 2 | list, array |
link |
| Reversed Words | 1 | str, sort, list, array |
link |
| Return Negative | 1 | int, numbers, arithmetic |
link |
| Returning Strings | 1 | str, format |
link |
| Reversed sequence | 1 | int, numbers, list, array, sort |
link |
| Reversed Strings | 2 | str, format, list, array |
link |
| Sentence Smash | 1 | str, format, list, array |
link |
| Sort and Star | 2 | str, format, link, array |
link |
| Squash the bugs | 2 | str, list, array |
link |
| Square(n) Sum | 1 | int, numbers, math, arithmetic |
link |
| String repeat | 1 | str, format |
link |
| Stringy Strings | 1 | str, int, format |
link |
| Sum Arrays | 1 | list, array |
link |
| Sum Mixed Array | 2 | int, numbers, list, array |
link |
| Sum of positive | 1 | int, numbers, list, array, arithmetic |
link |
| Sum without highest and lowest number | 1 | str, format |
link |
| Swap Values | 2 | list, array, swap |
link |
| Switch it Up! | 1 | dict, hashmap, switch |
link |
| The Feast of Many Beasts | 1 | list, array |
link |
| The Wide-Mouthed frog! | 1 | str, control flow |
link |
| Thinkful - Dictionary drills: Order filler | 1 | dict, hashmap |
link |
| Third Angle of a Triangle | 1 | int, math, arithmetic |
link |
| Total amount of points | 1 | int, list, array, arithmetic |
link |
| Transportation on vacation | 1 | int, numbers, math, arithmetic |
link |
| Triple Trouble | 2 | str, array, list, format |
link |
| Unfinished Loop - Bug Fixing # 1 | 1 | loops, bug |
link |
| Volume of a Cuboid | 1 | int, math, arithmetic |
link |
| Vowel remover | 2 | str, format, list, array |
link |
| Welcome! | 2 | str, dict, hashmap |
link |
| What's the real floor? | 1 | int, control flow |
link |
| Will there be enough space? | 2 | int, arithmetic |
link |
| Will you make it? | 1 | int, arithmetic |
link |
| You only need one - Beginner | 1 | list, array |
link |