# Welcome to Python ## Module 6 --- ## Learning a second (programming) language --- ## Module 6 Overview - Week 17: Python language - Week 18: Python web applications - Week 19: Docker - Week 20: Group projects --- ## This week - Today: Python setup - Tuesday: Python data types - Wednesday: Python collections - Thursday: Python classes - Friday: Review --- ## Today... - Online networking lecture videos (20min) - Online networking reading (30min) - Python readings & videos (30 min) - Set up Pyenv and Python: use these [set up instructions](https://github.com/appacademy/unified-setup/blob/main/python-setup.md) - Start building online presence (Get Your Profile Up activity) - Work on homework for tomorrow (skip "Installing Pyenv..." since you will have already done the set up) --- ## JavaScript vs. Python | | JavaScript | Python | | --------------- | ---------- | ------ | | Strings | ☑ | ☑ | | Booleans | ☑ | ☑ | | Arrays (Lists) | ☑ | ☑ | | Functions | ☑ | ☑ | | Classes | ☑ | ☑ | | Loops | ☑ | ☑ | | if-else | ☑ | ☑ | --- ## So what _is_ the difference? --- ### JavaScript runs in the browser - JavaScript is the language of the browser - Python is not going to manipulate the DOM, or replace React. - You can write your server in Python, but not the front-end code. --- ### Python is great multi-purpose tool - Python does backend really well (we'll see this firsthand next week!) - Python has diverse popular libraries that extend the functionality. - widely used by for applications in sciences, machine learning --- ### Syntax You're gonna do the same things, but it will look different. - whitespace aware vs. curly braces for code blocks - no more semi-colons to end lines - `True` and `False` instead of `true` and `false` - and MUCH more --- ### Python style guide - People may have opinions on how to format your JavaScript code... - But Python (the language!) has opinions about how to format your Python code. - [PEP 8 style guide](https://www.python.org/dev/peps/pep-0008/) - Python has opinions on more than just styling... --- ### [The Zen of Python, by Tim Peters](https://www.python.org/dev/peps/pep-0020/) ``` Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those! ```