- Hello, I'm extremely new to Python and wanted to try out the newly taught functions, and cobble up this:
def print_thrice(a):
print(a)
print(a)
print(a)
def prt(a,b):
print_thrice(a)
print(b)
print_thrice(prt("Name:","Age:"))
I expected it to print out Name: Name: Name: Age:
(with linebreaks of course) 9 times, but what I got turns to be
Name:
Name:
Name:
Age:
None
None
None
What I had in mind was to have 9 of Name: Name: Name: Age:
, so I tried to print_thrice
the already printed thrice Name:
along withAge:
in prt("Name:","Age:")
. The first 3 evidently appeared, which I guess means that the first batch of print_thrice
worked, but I have no idea why I'd be getting three Nones afterwards.
Eventually I gave up and just did 3 lines of prt("Name:","Age:")
instead of print_thrice(prt("Name:","Age:"))
, and it seemed to work fine.
Can anyone please explain what I did wrong?