print "Hello World"

"""
Explanation: <img src="https://www.python.org/static/img/python-logo.png">
Welcome to my lessons

Bo Zhang (NAOC, &#98;&#111;&#122;&#104;&#97;&#110;&#103;&#64;&#110;&#97;&#111;&#46;&#99;&#97;&#115;&#46;&#99;&#110;) will have a few lessons on python.

These are very useful knowledge, skills and code styles when you use python to process astronomical data.
All materials can be found on my github page.
jupyter notebook (formerly named ipython notebook) is recommeded


These lectures are organized as below:
1. install python
2. basic syntax
3. numerical computing
4. scientific computing
5. plotting
6. astronomical data processing
7. high performance computing
8. version control
What is python?

Python is an interpreted, object-oriented, high-level programming language with dynamic semantics.
Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. 
Python's simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. 
Python supports modules and packages, which encourages program modularity and code reuse.
The Python interpreter and the extensive standard library are available in source or binary form without charge for all major platforms, and can be freely distributed.


Often, programmers fall in love with Python because of the increased productivity it provides. Since there is no compilation step, the edit-test-debug cycle is incredibly fast. Debugging Python programs is easy: a bug or bad input will never cause a segmentation fault. Instead, when the interpreter discovers an error, it raises an exception. When the program doesn't catch the exception, the interpreter prints a stack trace. A source level debugger allows inspection of local and global variables, evaluation of arbitrary expressions, setting breakpoints, stepping through the code a line at a time, and so on. The debugger is written in Python itself, testifying to Python's introspective power. On the other hand, often the quickest way to debug a program is to add a few print statements to the source: the fast edit-test-debug cycle makes this simple approach very effective.
reference: https://www.python.org/doc/essays/blurb/
comparison with some other programming languages: https://www.python.org/doc/essays/comparisons/
Benefits for astronomers

easy-to-use/understand
extensions
astronomical packages
high performance computing
open source

Websites you'd better know

python.org: https://www.python.org/
this is the official web page of python
 
pypi (PYthon Package Index): https://pypi.python.org/pypi
from here, you can download almost all python packages
 

How to install python in Linux (Ubuntu)?

install python via $ sudo apt-get install python
install pip via getpip.py

PS: $ sudo apt-get install python-pip is not recommended
pip can install almost all python packages.
So I recommend you use this to install all packages.
An alternative is to use easy_install, a very similar tool.
type $ python to enter the python shell
End of explanation
"""


%magic

%%bash
ls -a

"""
Explanation: Recommended IDEs

spyder / python(x,y) / WinPython(windows only)
scientific computing
easy-to-use
ipython backend
profile

pdb



jupyter console / qtconsole (ipython / ipython qtconsole)

shell-like

magic functions




jupyter notebook (ipython notebook)

magic functions
markdown

various format (html, pdf, ...)



JetBrain (Pycharm)

code folding
version control
module test
code reformat


Anaconda

why anaconda
End of explanation
"""


from IPython.core.display import HTML

def css_styling():
    styles = open("../styles/custom_ppbmh_modified.css", "r").read()
    return HTML(styles)
css_styling()

"""
Explanation: HOMEWORK

try to install python & numpy using pip
try at least two of the (recommended) python IDEs
try at least two of the magic function in jupyter/ipython
End of explanation
"""


