I hereby claim:
- I am sherifzain on github.
- I am sherifzain (https://keybase.io/sherifzain) on keybase.
- I have a public key ASBqYVOQcTJSCr5edYhnflebGJpsGIwJfLjRQ2PRSVO0hgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
def _is_anagram(s1, s2): | |
for c in s1: | |
if c in s2: | |
s2 = s2.replace(c, '', 1) | |
continue | |
else: | |
return False | |
return len(s2) == 0 | |
""" | |
HINT 1: Run this file first to see how the current implementation of memcache | |
deals with adding a host. | |
You'll need to setup 8 running memcached instances on the following ports: | |
11211 | |
11212 | |
11213 | |
11214 | |
11215 |
import re | |
def find_shortest_subsegment(paragraph, words): | |
words = [word.lower() for word in words] | |
paragraph_words = re.findall(r"[\w']+", paragraph) | |
paragraph_words = [word.lower() for word in paragraph_words] | |
possible_results = [] | |
for pword in paragraph_words: | |
for result in possible_results: | |
if not all([True if word in result else False for word in words]): |
#!/usr/bin/python | |
import random | |
import unittest | |
def rand1to5(): | |
return random.randint(1, 5) | |
def rand1to7(): | |
rand = rand1to5() + rand1to5() - 1 | |
return ((rand % 7) + 1) |
import beanstalkc | |
import gevent | |
def producer(): | |
beanstalk = beanstalkc.Connection() | |
# using tube 'test' | |
beanstalk.use('test') | |
print('PRODUCER: Starting a producer, putting jobs on "test" tube...') | |
i = 1 | |
while True: |
#!/usr/bin/python | |
''' | |
Problem Statement: | |
You are to write a program that takes a list of strings containing integers and words and returns a sorted version of the list. The output should maintain the positions of strings and numbers as they appeared in the original string (See example 4 below). | |
The goal is to sort this list in such a way that all words are in alphabetical order and all integers are in numerical order. Furthermore, if the nth element in the list is an integer it must | |
remain an integer, and if it is a word it must remain a word. | |