Installing Python3 on Pycharm
Why I am studying Python
As I am interested in learning software algorithm topics, I happended to look at MIT's OCW course 'Introduction to Algorithms'. This is a great materials to learn algorithms and I found that they have 2 recommended books for reading: 1) the famous CLRS book and 2) Problem Solving with Algorithms and Data Structures Using Python SECOND EDITION. Interestingly, we can obtain both books online, if you google them. I think that the second book is also a good start point to learn Python language. As for the second book, thankfully, it has a online version too.
My IDE is PyCharm
So, I searched the Python IDE to install on my Mac machine and found that Pycharm is recommended by many people. Some people recommended Pydev with Eclipse but I don't want to have another IDE than one that I use for java language. Another reason that I prefer Pycham is that it has a community version even though it's a commercial IDE. It's very convenient tool and I can write code in editor and run command on console in it.
Python 2 vs. Python 3
While I was studying the second book's '1.8. Getting Started with Data', I found that my results of running examples listed on the page are different from the results from the page. For example, mine don't have fractional part when diving integers. So, I googled it and found that my Python interpreter was 2.69 and I need Python v.3 for the same result.
How to use Python 3 in Pycharm
I have checked Pycharm's settings by clicking 'PyCharm Community Edition > Preference > Project > Project Interpreter.' I clicked the up-down button next to my Python library location but I could not see Pycharm v3. There were 2.69 and 2.7. Hmmm... So I searched on the web but answers are not explaining it directly. I thought I could find some download or update button for installing Python 3 but there's none in Pycharm.
So, I tried to download Python 3 from Python site. After finishing the installation, I could see the new 3.6 version in the Project Interpreter window. After changing it to 3.6, I restarted PyCharm. Also, I need to change the version for the Python console setting in 'PyCharm Community Edition > Preference > Build, Execution, Deployment > Console > Python Console.'
Ah, also there was a page explaining why we have 2 versions of Python until now.
Interesting things in Python Data
Python has lots of features on new data types that we could not see in Java or C#, C, and so on. It has 'set', 'tuple', etc. Interestingly, when we use pop() for list, it pops the last element. However, when we call pop for set, it pops the first element. Also, maybe we need to keep in mind that list, and string are mutable but tuple is immutable, which means that we cannot set a element directly with [] operator. e.g.) myName[0]='X' is not possible.
There might be different behaviors between versions of Python 3.
As for the dictionary in Python, when we print the key, value pair of a dictionary, my result shows the pairs just as I inserted them but the page shows different result by explaining that the elements are sorted by hash values.