Python Algebra, terminal question

I´m trying to practice Algebra with Python in Week 2 using VS Code to run some of the algorithms.

I can’t get one of them to run:

def one_step_addition():
    import random
    #Display problem
    a = random.randint(-4, 10)
    b = random.randint(2, 24)
    print("x + ", a, " = ", b)
    ans = float(input("x = "))
    answer = b - a
    #Test input
    if ans==answer:
        print("Correct \n")
        print("Try again")
        print("The correct answer is ", answer, "\n")

I don’t know what perimeter to give one_step_addition() to make it run.
Maybe I’m making a dumb mistake, but why can’t I get it to run in the terminal?

To run the one_step_addition() function in the terminal, you need to call the function. You simply need to write one_step_addition() in the end

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.