This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| import numpy as np | |
| def get_reads_and_writes(lines, wanted): | |
| result = [] | |
| for line in lines: | |
| _, name, value = line.split(':') | |
| if name == wanted: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| message_file=$1 | |
| echo "" >> $message_file | |
| random_wiki=`curl -s --head https://en.wikipedia.org/wiki/Special:Random | grep 'location: ' | cut -d ' ' -f 2` | |
| echo "In case you are interested, you may read about $random_wiki" >> $message_file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| See https://www.codewars.com/kata/all-that-is-open-must-be-closed-dot-dot-dot | |
| ## Background | |
| We all know about "balancing parentheses" (plus brackets, braces and chevrons) | |
| and even balancing characters that are identical. | |
| Read that last sentence again, I balanced different characters and identical | |
| characters twice and you didn't even notice... :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| See the full table at http://www.hemi.nsu.ru/mends.htm | |
| """ | |
| MENDELEEV_TABLE = { | |
| 'H': 1, | |
| 'He': 4, | |
| 'Li': 7, | |
| 'Be': 9, | |
| 'B': 11, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| See https://www.codewars.com/kata/digital-cypher | |
| """ | |
| import itertools | |
| import string | |
| ABC = string.ascii_lowercase |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| """ | |
| Можно скачать Войну и Мир здесь | |
| http://vojnaimir.ru/files/book1.txt | |
| http://vojnaimir.ru/files/book2.txt | |
| """ | |
| import codecs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| See https://www.codewars.com/kata/love-vs-friendship/train/python | |
| If a = 1, b = 2, c = 3 ... z = 26 | |
| Then l + o + v + e = 54 | |
| and f + r + i + e + n + d + s + h + i + p = 108 | |
| So friendship is twice stronger than love :-) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import random | |
| NAME_TO_GITHUB = { | |
| 'Adam': 'ajbeairsto', | |
| 'Ihor': 'ikalnytskyi', | |
| 'Ivan': 'inesusvet', | |
| 'Maddie': 'madmott', | |
| 'Roman P': 'malor', | |
| 'Roman K': 'romankolpak', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| a = 'space' | |
| print(a) | |
| a = 100500 | |
| print(a) | |
| a = -6.5 | |
| print(a) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| See https://www.codewars.com/kata/reverse-polish-notation-calculator | |
| Your job is to create a calculator which evaluates expressions in Reverse Polish notation. | |
| For example expression 5 1 2 + 4 * + 3 - (which is equivalent to 5 + ((1 + 2) * 4) - 3 in normal notation) | |
| should evaluate to 14. | |
| For your convenience, the input is formatted such that a space is provided between every token. | |
| Empty expression should evaluate to 0. | |
| Valid operations are +, -, *, /. | |
| You may assume that there won't be exceptional situations (like stack underflow or division by zero). |