Today in class we went over the concepts of If, Elif and While:
If: Sets the condition for a response depending on what the player or user of the code has provided
Elif: Although not shown in my code, Elif is how to write therefor in the code, meaning that it provides a response based on the response of the If command.
While: Creates a loop to set a response for an input of an answer that was not of the given answers.
Loops: When would you use a ‘while’ loop and when is it appropriate to use a ‘For i in ___’ loop? explain in detail:
It is a lot easier to use the while loop because instead of infinitely looping, it loops until you get the correct answer, where it will stop looping. The ‘for’ loop will keep repeating for a set amount of times which can’t be affected by the user who can correct the mistake.