I am trying to learn what notes are where on the guitar, so I want to be able to type in what the string is tuned to and what fret I am playing and have the program tell me what note it is or type in the note and get back all the different places I can play it.
So far, I have a program that tells me what the note is based on the string and fret but I just wrote it the long way and it takes a lot of processing power. Based on what the user types in for what the string is tuned to, it opens a function for that string which asks what fret is being used, then based on the fret it runs one of the many elif
s that I individually typed out.
For example:
elif fret == '3':
print('That note is E')
I know there's a way to do it with not nearly as much code, but I'm really new to programming clearly and can't quite come up with the logic.
Build a pair of dicts that map note names to pitch numbers and back, and you can build a simple function to do this, like: