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
def convert_string_to_color(str): | |
hashed = 0 | |
for i in range(len(str)): | |
hashed = ord(str[i]) + ((hashed << 5) - hashed) | |
colour = '#' | |
for i in range(3): | |
value = hashed >> i * 8 & 255 | |
colour += f'00{value:x}'[-2:] | |
return colour |
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 argparse | |
def main(dir): | |
print(f'I am the directory: {dir}') | |
def parse_args(): | |
"""Parse command line arguments. | |
Returns: | |
dict: The parsed arguments. |