You have 6 buttons that depending on which are down (5V?) and up (0V?) "selects" a port?
Change the 0V to 0 and the 5V to 1.
All 6 buttons need to be debounced if they are contact switches. Since you never said, I can only guess.
When 6 buttons get turned into 6 bits it's possible to use bitwise logic to compare port patterns to button bits.
Question is, do you understand bits and bitwise logic? You should.
You wouldn't believe how many people cheat or slide through courses thinking that they know the material because their eyes passed over it. Every semester, buried deeper and expect to catch up over a deadline by being shown what to do.