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
max_pal = 0 | |
for x in range(100, 1000): | |
for y in range(x, 1000): | |
number = x * y | |
if number > max_pal: | |
numStr = str(number) | |
if numStr == numStr[::-1]: | |
max_pal = number |
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
from itertools import product | |
print(max(number for number in (n*m for n, m in product(range(100, 1000), range(100, 1000))) if str(number) == str(number)[::-1])) |
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
from gevent import monkey | |
monkey.patch_all() | |
from gevent.pool import Pool | |
import json | |
import requests | |
def download_file(url): |
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 -*- | |
from gevent import monkey | |
monkey.patch_all() | |
import re | |
import time | |
import requests |
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 | |
# -*- encoding=utf8 -*- | |
__author__ = 'Piotr "Kiro" Karkut' | |
__license__ = "BSD" | |
import socket | |
from struct import * | |
from time import sleep | |
import os |
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 numbers | |
def remove_empty_nodes(struct): | |
""" | |
In: [1, 2, [], 0, {'a': 'b', 'c': '', 'd': {'1': []}}, [1, [2, [[], []]]]] | |
Out: [1, 2, 0, {'a': 'b'}, [1, [2]]] | |
""" | |
def keep(v): | |
return isinstance(v, numbers.Number) or v |