You coded your program a bit awkwardly. However, that aside, you can get your method to output by using the print
statement as opposed to the return
.
Otherwise, when you return something from a function you need to assign what is returned to some variable(s).
For example:
def getter():
return "Hello, world"
r = getter()
print r
Output:
Hello, world
So, return "Hello, world"
will assign "Hello, world"
to r
. However, nothing will be shown in your terminal. In order for it to be shown in your terminal, you would have to use the print
statement.
And just as a side note, it is best to paste your code in as opposed to attaching pictures.
solved Program will not run completely through code (no errors) Python 2.7.15 [closed]