Python Homework help needed, not to challenging!?

Need help with my programming homework, This is what it states..

Write a program that will allow a student to enter their name and then ask them to solve mathematical equations. The program should display two random numbers that are to be added, such as:

+

The program should allow the student to enter the answer. The program should then display whether the answer was right or wrong, and accumulate the correct values. After the questions are asked, calculate the average correct. Then display the student name, the number correct, and the average correct in both decimal and percentage format.

I have created a flow chart and need help creating this code.

all i have right now is

#Variables

studentName =

numQuestions =

operatorList = (“+”,”-“,”*”)

#Main Variable

def main()

print (‘Welcome to the question mathmatical test’)

studentName = (input(‘What is your name?:’))

def testQuestions()

✅ Answers

? Favorite Answer

  • You need to do some revision on what is a variable and what is a function. The three variables you listed first under the #Variables comment are variables, but the under the #Main Variable comment you have a function.

    The sprogram specification only mentioned addition so you should get rid of the operatorList variable entirely. You could also get rid of studentName and numQuestions but it’s no big deal.

    First off it’s obvious that you’re going to need a loop because the program has to do something times. We can draw it up a little neater so that it’s easier to see how it can become code. Lets rewrite the specification like this.

    . get the users name

    . display random numbers that are to be added

    . get an answer from the user

    . if the answer is correct, tell them so

        otherwise if it’s wrong, tell them that

    . reapet from step until ten questions have been done

    . display the correct answer percentage as percentage

        and as a decimal fraction

        and the total number of correct answers

    It’s pretty straight forward to write something like that up and it doesn’t have to conform to some language but already by doing that you’ve just written an algorithm which is what a program is. It’s also now easy to notice the loop from step to and also the if else branch at step .

    I’ll try and start you off a little but not too much.

    print(“Welcome to the question mathmatical test”)

    studentName = input(“whats you’r name?: “) # this is step

    correct

    ✅ Answers

    =

    numQuestions =

    while numQuestions < : # this line is actually step btw

        ### fill in step ###

        ### fill in step ###

        if studentAnswer == actualAnswer:

            ### fill in step (first case) ###

            correct

    ✅ Answers

    +=

        else:

            ### fill in step (second case) ###

        numQuestions +=

    ### (fill in step ) ###

    step should be the most difficult for you.

  • For a first time snake owner kingsnakes, cornsnakes, and milksnakes all make good pets. A lot of pet shops will tell you that ball pythons make good first time snakes but they really don’t…ball pythons take specific humidity requirements and ball pythons can go on really long hunger strikes (like for a year) which by the end of it both snake and owner are stressed out. Kings, corns, and milks can tolerate handling and don’t need a whole lot of humidity. And they are usually docile snakes. Small is relative with snakes (it all depends on what you think of as small for a snake). Ball pythons stay small (usually ‘ or less) but they are kind of thick. Corn snakes can get up to ‘ but they stay really skinny Good luck!

  • Leave a Comment