Skip to content

Instantly share code, notes, and snippets.

@renzon
renzon / string_n_string.py
Last active January 3, 2019 12:23 — forked from dubirajara/string_n_string.py
String -> N iterations -> String created by dubirajara1 - https://repl.it/@dubirajara1/String-greater-N-iterations-greater-String
from itertools import chain
def string_n_string(s, n):
for _ in range(n):
even = (char for i, char in enumerate(s) if i % 2 == 0)
odd = (char for i, char in enumerate(s) if i % 2 != 0)
s = ''.join(chain(even , odd))
return s
@renzon
renzon / sequence_x_removal.py
Last active November 22, 2017 12:12 — forked from vmesel/sequence_x_removal.py
Problema do Jimmy Neutron
from collections import deque
from itertools import cycle
import pytest
REPLACEMENTS = ["CCTTGG", "CTATGG", "CCACGG"]
def replace_gen_sub_seq(seq, replacements):
seq = list(seq)
s = """{u'search_metadata': {u'count': 100, u'completed_in': 0.23599999999999999, u'max_id_str': u'407528290757668864', u'since_id_str': u'0', u'next_r
esults': u'?max_id=407528086326870015&q=%23PlateiaLuanSantana&count=100&include_entities=1', u'refresh_url': u'?since_id=407528290757668864&q=%2
3PlateiaLuanSantana&include_entities=1', u'since_id': 0, u'query': u'%23PlateiaLuanSantana', u'max_id': 407528290757668864}, u'statuses': [{u'co
ntributors': None, u'truncated': False, u'text': u'#PlateiaLuanSantana NUNCA FUI POR FAVOR ME SORTEIA @CFLuanSantana u', u'in_reply_to_status_id
': None, u'id': 407528290757668864, u'favorite_count': 0, u'source': u'<a href="http://twitter.com/download/iphone" rel="nofollow">Twitter for i
Phone</a>', u'retweeted': False, u'coordinates': None, u'entities': {u'symbols': [], u'user_mentions': [{u'id': 177021046, u'indices': [51, 65],
u'id_str': u'177021046', u'screen_name': u'CFLuanSantana', u'name': u'Central de f\xe3s LS.'}], u'hashtags': [{u'indices': [0, 19], u'text': u'
Pla