Python Forum
how to make a mathematical operation without the command "print" - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: how to make a mathematical operation without the command "print" (/thread-8972.html)



how to make a mathematical operation without the command "print" - ewar2606 - Mar-15-2018

how to make a mathematical operation without the command "print"?

I'm studing in a university, and i need this information to learn about this program for a curse.REALY THANKS to the people that can help me.


RE: how to make a mathematical operation without the command "print" - wavic - Mar-15-2018

print just shows the value of an expression or an object. Nothing with the mathematics. What do you mean?


RE: how to make a mathematical operation without the command "print" - ewar2606 - Mar-15-2018

(Mar-15-2018, 04:51 PM)wavic Wrote: print just shows the value of an expression or an object. Nothing with the mathematics. What do you mean?

Okey the problem is that i want to put the result of an operation, but the program not put it, only stay in white when i press run . Sorry i'm a beginner with this


RE: how to make a mathematical operation without the command "print" - wavic - Mar-15-2018

Put it where? Here is some math in the interpreter:

>>> 2 * 40 / 5
16.0
Do you mean this?


RE: how to make a mathematical operation without the command "print" - sparkz_alot - Mar-15-2018

You need to be more specific. Nothing prints unless you tell it to print (except the interpreter). For example:

def mult(A, b):
    result = a * b

    return result

product = mult(2, 3)
will not print anything unless you add a 'print()' function somewhere, either within the mult() function or as a line after calling the mult() function for example:

def mult(A, b):
    result = a * b

    return result

product = mult(2, 3)
print(product)
Note that you do not need to print anything, you could also use the variable 'result' in another computation or function. Remember, the print() function is for humans to see what is happening within a program, not necessarily a requirement. This ability to see is also why the print() function is a valuable tool when trouble shooting.