How to print on different lines

I am solving the beginner problem but I am facing difficulty


Please I need help asap

Aren’t you supposed to write the “print(x)” four times using addition, subtraction, multiplication and division?
IE:

print(x+x)
print(x-x)
print(x*x)
print(x/x)

You suppose to use one print syntax to do all that with help \n

The prompt says "print statements" hence it’s plural. However, if you must do it with one print statement what you can do is to use the + to concat and then pass your math through str() since python doesn’t like printing strings with integers. So you could would look something like this:

print(str(1+1) + "\n" + str(1-1))

which prints out:

2
0

With this, you should be able to finish the prompt with one print statement.

1 Like