Randomly generating math questions

后端 未结 2 1084
迷失自我
迷失自我 2021-01-22 06:43

My task is to produce a code that greets the user and asks their name storing their name as username. Then generates 2 random numbers and an operation. The questio

2条回答
  •  情话喂你
    2021-01-22 07:38

    You have many discrepancies in variable names and indentation. Remember Python is case sensitive. And by the way, the condition in your while loop will cause your program not to ask any questions.

    So for example, you created a list of operations called Ops and then used the random module to select an operation from ops. Python will inevitably throw an error, as ops is not actually defined. Instead, you should use Ops because that is the variable you actually declared, with a capital letter. Again, Python is case sensitive.

    Likewise, Python recognizes a difference between questionAsked and questionsAsked. It's one or the other, so choose a name and be consistent.

提交回复
热议问题