Particularly this line:
while userChoice != 1 and userChoice !=2 and userChoice !=3 and userChoice !=4 and userChoice !=5 and userChoice != 6 :
The reason im asking is because my teacher mentioned this to get the loop going for the menu
but im sure there is a far more elegant way of doing this
simple sentinel variable for when you got an answer? is that what you would do?
Yes the "if/elif/else" construct is often used to solve problems like this . Python does not have a "case..end case" construct in the language so the code shown in the second example is the usual way to address this pythonically. There are more sophisticated ways to let the data drive the selection, but may I suggest that you let that be a learning experience much further in your Python journey? 🙂
My first bit of advice is that if you are going to be a mime, you shouldn't talk. Even the tiny ad is nodding:
Create Edit Print & Convert PDF Using Free API with Java