r/madeinpython • • Dec 17 '20

Created a Calculator using a separate file, thought it would be nice to share

I wanted to really understand how separate files work, I always gear my python programs to one file but want to break them apart. Mostly because I didn't understand how to properly do it.

I created this project on github to really practice and drive home the concept for myself. I thought it would be nice to share if anyone else was curious.

It has a PersistentCalculator class which keeps track of the calculation history and calls the functions outside of the class for the actual calculation

24 Upvotes

3 comments sorted by

3

u/AreYouThreateningMe Dec 18 '20

I found a bug in app.py on line 19:

age = abs(age)

I think you meant abs(diff). :)

3

u/Srz2 Dec 18 '20

Much appreciated! Just fixed it :)

3

u/networth25g Dec 18 '20

Thanks for sharing this!