This file contains 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
def find_path(): |
This file contains 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
```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 |
This file contains 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 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") |
This file contains 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
"""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 |
This file contains 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
"""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) |
This file contains 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
"""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 |