It's my first time posting to Codecademy, so pardon me for any faux pas being new to coding & this community.
Came across old forum response on Codecademy differentiating print and return using the following script:
print "I printed"
return "I returned"
f1 = function_that_prints()
f2 = function_that_returns()
print "Now let us see what the values of f1 and f2 are"
Now I am wondering why "I printed" printed before anything else, since function wouldn't execute by merely equating it with f1?
No outright error, but
1. The order of print within a function seems to get called without actually calling.
2. A print statement didn't actually print when placed after a return inside a function (please see test_returnB in my messy amateur script)
1. The function shouldn't execute by merely associating it with f1?
2. actually print test_returnA AND test_returnB, rather than missing that test_returnB following a return
#Added test prints print ("test_1") def function_that_returns(): print ("test_returnA") return "I returned" print ("test_returnB") print("test_2") def function_that_prints(): print ("test_printA") print ("I printed") print ("test_printB") print("test_3") f1 = function_that_prints() print("test_4") f2 = function_that_returns() print("test_5") print ("Let's see what the values of f1 and f2 are") print("test_6") print (f1) print("test_7") print (f2) print("test_8")