from my initial understanding I needed to have print() in order to
display something,
Loosely speak, you do, unless something else is doing the printing for
you.
without knowing that input() does the same with added user input. So I
ended up having input(print()) which caused print() to return none.
Wrapping a call to print()
as an argument inside a call to input()
has no effect whatsoever on the behaviour of print()
.
A call to print()
will print a single newline character to the
standard output (generally your terminal unless you’ve made special
arrangements).
Your call to input()
behaves the same with or without the print()
as
a parameter. What you might by misinterpreting is that the newline
from print()
affects your display. But the behaviour would be the same
if you’d written:
print()
input()
The newline character gets displayed as a carriage return and a linefeed
on a terminal, which moves your cursor to the left and then down a line,
effectively moving it to the “next line”. And then your input()
call
runs.
Let’s see what input()
says about itself:
Python 3.9.13 (main, Aug 11 2022, 14:01:42)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> help(input)
Help on built-in function input in module builtins:
input(prompt=None, /)
Read a string from standard input. The trailing newline is stripped.
The prompt string, if given, is printed to standard output without a
trailing newline before reading input.
If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.
On *nix systems, readline is used if available.
>>>
When you called input(print())
then following happens:
print()
is called to compute the argument to pass to input()
print()
does its output and then returns a value, and that value is
None
, as mentioned
- so you then call
input(None)
, being the value from print
- according to the
help
above, input only issues a prompt string “if
given”
- as defined, if a prompt isn’t given, the default value is
None
,
and that’s what print()
returned, so input()
still behaves as if
you had not given it a prompt string
This isn’t as large a coincidence as you might think, because in Python
the None
value is what we almost always pass around as a placeholder
for “no value supplied/specified”.
“But useful to confirm that variable have the values you expected them
to have. Which we all do a lot when trying to figure out why our programmes
are not doing what we thought they should.”
I shall keep this in mind always 
Aye.
My computer always does exactly what I tell it to do but sometimes I
have trouble finding out what it was that I told it to do.
Cheers,
Cameron Simpson cs@cskk.id.au