I started learn python few days ago on code academy because its the best site I know for learning programming.(first time learning programming).
I downloaded python 3.5.1 from python’s site, and I try to do some things from the code academy in the real python, but I always get errors. one example: when I try to
def a 2nd function it bugs out and says syntax error.
also the parentheses to print arent used in code academy.
so my question is: Is learning python on code academy still relevant and useful or I should move to another site?
(btw if you can tell me how to
def more then one function it’ll be nice (:
Was just getting to that. Is the tutorial still relevant? Yes. It is important to learn a language from its roots, not just the newest version. This way we can recognize old version code when we see it.
Python 2.7.x permits us to use parens on print statements so go ahead and do that for practice so you get in the habit.
k thx. im just openning another topic I really need help with. if you can help it will be nice (:
Totally. If I hadn’t taken the Python2 course, I wouldn’t be doing anything nearly as advanced as what I’m able to do in Python3 right now. There’ll be syntax differences and different functions, but transferring between the two shouldn’t be too difficult
btw zystvan how can I
def two functions in python3? after I do the first one, I press enter,
def a(b) and then enter and its an error and I cant write the ‘a’ function. so what to do?
@shakedst Like this:
def foo(x): return(x) def bar(): return(1 + 2) foo("hello") bar()
I tried that on python 3.5 IDLE and it doesnt work…
@shakedst You need code inside
bar(). An empty function will always throw an error, regardless of the Python version.
@shakedst Sure looks empty to me.
foo() has code inside it, that’s good. Now
bar() needs code inside it, just like
foo(). Like this:
def foo(x): return(x) def bar(): return(1 + 2)
see : the problem is: I cant put a code in
bar(). thats the problem!
I press enter after the
def bar() line and it gives the error, no option for putting a code.
@shakedst Have you tried Shift + Enter?
yep.still not working