Is the python tutorial still relevant?(q)


#1

Hi,
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.
https://gyazo.com/2e3ef21d526a5ac45d1cff284295b642
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 (:
thanks, Shaked


#3

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.


#4

k thx. im just openning another topic I really need help with. if you can help it will be nice (:


#5

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 :slightly_smiling:


#6

thanks (:
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?


#7

@shakedst Like this:

def foo(x):
  return(x)

def bar():
  return(1 + 2)

foo("hello")
bar()

#8

I tried that on python 3.5 IDLE and it doesnt work...


#9


what is the problem?


#10

@shakedst You need code inside bar(). An empty function will always throw an error, regardless of the Python version.


#11

not empty still error...


#12

@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)

#13

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.


#14

@shakedst Have you tried Shift + Enter?


#15

yep.still not working


#16

got it!