1.) Before We Begin Passes But Not Right


So my code is as below and it is a simple lesson. However, it did not put up 42 on the screen. I do not know if this is necessary since it asked only to return the value but I was assuming it would come back up on the screen. So I was wondering how I would get that without using arguments like it asked in the instructions. I figure this is important to this lesson so I better get it right before I move on.

def answer():
    return 42.


You need a print statement somewhere. And you need to remove that period after 42 or else it's going to print "42.0".

There's three ways you can print 42.

def answer():

def answer():
    return 42

print answer()


Ah thanks! And yeah the period got in when I pasted my code in somehow xD


Actually neither of those passed... I keep getting the error that you printed 42 instead of returning but I guess you fixed that in your edit


Yeah, I realized that you needed to return something. The 1st option is for when you don't need to return anything haha.


ok thanks! However, it still doesn't print 42 to the screen...

def answer():
    return 42
    print 42


Did you try option #2? and can you link the lesson too?


Yeah I tried all the options. #1 and #2 both give the print instead of return error and #3 passes but puts up none and yeah here is the lesson below



haha, it's because they didn't want you to print anything!
For me #1 and #2 does print the number on the screen but it gives the error. #3...doesn't work, I'll change that.


Yeah, I was wondering about that. I said in my first post I wasn't for sure it needed to go up there but anyhow xD I learned a nice bit about this so that is good thanks for the help!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.