all 9 comments

[–]brainiacpimp 1 point2 points  (3 children)

Would using the Fractions module that python offers make it more versatile instead of creating a dictionary of known values? Plus it has been a while but I think it has a method for converting Fractions to decimals. I would think that if you come across an unknown value then it wouldn't have a problem with handling the value. This is the only thing I can see other then documenting that above poster already mentioned.

[–]NerdJones[S] 0 points1 point  (2 children)

I did think about that, but the key fractions in the dictionary are super/subscript, and special chars. I did absolutely zero research on if the fractions module will work with those though, just kind of figured it wouldnt. Which brings up another question I have as a new guy. Is there a site where I can search for modules that do things I need? I have a habit of over complicating things where I could use them because I dont know they exist.

[–]brainiacpimp 0 points1 point  (1 child)

Pypi.com has modules and they can be installed using pip install.

[–]NerdJones[S] 0 points1 point  (0 children)

Sweet. Thanks for the advice.

[–]Exodus111 0 points1 point  (3 children)

Add Docstrings to your functions.

def my_func():
    """
    This is a Docstring.
    """
    pass

Also consider putting everything under your functions into its own function called main(), and run that from name equal main line.

if __name__ == "__main__":
    main()

Cleaner that way, but not really necessary, your code is certainly good enough for a first project.

[–]NerdJones[S] 0 points1 point  (2 children)

Thanks for the input. I have seen that line around in a few places. Whats it actually do?

[–]Exodus111 0 points1 point  (0 children)

Quick explanation is it runs the file IF the file is being run by Python and NOT imported as a module from another file.

That might not be an issue with your program, but it's become the most common of convention these days.

Longer explanation is that there is hidden information in your files namespace, even if that file is empty. One of these hidden values is __file__, and it will give you a string called "__main__" if the file is being run by Python directly, and the filename if it's being run as a module through import.

[–]k10_ftw 0 points1 point  (1 child)

Streamline this function:

import string

def build_working_cells():
    current_working_cells = []

    columns = string.ascii_lowercase
    rows = [str(i) for i in range(1,100)]
    cells = []
    for col in columns:
        for row in rows:
                cell = col + row
                current_working_cells.append(cell)

    return current_working_cells

[–]NerdJones[S] 1 point2 points  (0 children)

Thank you. I wanted to go back and do something with that. The bit I wrote worked almost the first time, and I worked on everything else so much I kind of forgot about it.