Posts: 1,298
Threads: 38
Joined: Sep 2016
Mar-15-2018, 07:19 PM
(This post was last modified: Mar-15-2018, 07:19 PM by sparkz_alot.)
You need to be more specific. Nothing prints unless you tell it to print (except the interpreter). For example:
1 2 3 4 5 6 |
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:
1 2 3 4 5 6 7 |
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.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition