Jupyter vs Codecademy


#1

Hi everybody,
I am not sure if it is okay to post this question in this forum since it is not really an issue with codecademy. Since my first lecture in Python I have run jupyter in order to play around with the code before I have pasted the final result in codecademy. It always worked.
Since today, the range function does not work anymore; jupyter and codecademy produce different outcomes.

Could someone point me in the right direction or let me know who could help if this forum is not the right place for this question?

Thanks!


Replace this line with your code.


#2

The Jupyter notebook is based on Python 3, whereas The Python COurse on codecademy is based on Python 2


#3

Well, jupyter doesn't run any of the code, it's running python in the background, same as codecademy. However, like @bandit points out, codecademy uses a python with a lower major (the first and most significant number in the version notation) version number and there's bit of a compatibility break between python3 and python2, mainly regarding strings (changing to unicode)


#4

Thanks guys, understood...
I will look into the Py3 syntax of strings and lambda functions then...


#5

Lambdas are just function literals, same as "hello" is a string literal

The filter function returns an object that has not yet done the filtering, but it will do so when you ask for values from it by iterating through it, and it only goes as far as it has to (lazy evaluation)

So it doesn't return a list, but it returns something that can be iterated through

Differences between python2 and python3 should for the most part just be a matter of looking up what you're doing when things don't behave as you want


#6

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