Skip to content

Instantly share code, notes, and snippets.

View serashioda's full-sized avatar

Sera Smith serashioda

View GitHub Profile
@serashioda
serashioda / find_the_path.py
Created February 7, 2017 20:03
Find the Path
def find_path():
@serashioda
serashioda / the_task.txt
Created February 7, 2017 19:58
Find_the_path
```Write a function that takes a file path as the first argument, and a file extension as an optional second argument.
If the file extension is not None, then traverse the given file path looking for all instances of files with that extension.
SO…
If extension = ".py" and filepath = "/home/Nick/"
Return the absolute path to every file ending in that extension
import datetime
import datefinder
from dateutil.relativedelta import relativedelta
def date_rollback(large_string, date_formatter):
dates = list(datefinder.find_dates(large_string))
result = large_string
for date in dates:
to_find = date.strftime("%m/%d/%Y")
"""Implementation of the add_me module."""
def add_me(num_lst, sing_digit):
"""returns sum of list of nums as a whole num and adds single dig."""
num_sum = int(''.join(map(str, num_lst)))
result = num_sum + sing_digit
return result
"""The shell module to for the swap/shell function."""
def shell((start_post, swaps)):
"""swap position of ball under 3 cups."""
cups = [0, 0, 0]
cups[start_post] = 1
for i in cups:
cups[swap[1]] = cups[swap[0]]
return cups.index(1)
"""Test the rotation module."""
def rotation(str1, str2):
"""Check if str1 is a rotation of str2."""
for n in range (len(str1)):
str3 = str1[-n:] + str1[:-n]
if str2 == str3:
return True