🐍 Welcome to Python! 🐍
Posted on Oct 25th, 2021
Welcome to Phase 2, where we’ll be learning about back end development. Topics we’ll cover include:
- Python and object-oriented programming
- Building web applications with Django
- Working with a relational database
📅 Today’s topics
- Running Python
- Syntax differences between JS and Python
- Python
- variables
if
statementswhile
loops- Input and output with
input
andprint
- Functions
✅ TODO today
- Make sure your dev environment is set up, using our guide.
- Complete this introductory Learning Exercise on Exercism.io, using the in-browser editor.
- Complete the first part of this Python tutorial, through the ‘Functions’ section.
- Configure VS Code to use LiveShare. Test it out with a buddy to make sure it is working.
🐍 Code Break
Try working with input and output
🎯 Project
We’ll begin Python the way we began JavaScript, with some exercises and tests you can run to keep you on track. We’re going to use an awesome free online tool called Exercism.
Please sign up using your GitHub account (getting started instructions) and choose the Python track. There are two ways to use Exercism, in Practice Mode or Mentor Mode. Either one is fine for our purposes, but Practice Mode is less setup.
Work through their command line setup walkthrough to install Exercism on your computer.
To run the tests, you will need a testing library called pytest
installed. Run:
pip install pytest pytest-cache
In the Python track, complete the following exercises:
- Hello World
- Two Fer
- Raindrops
- Scrabble Score
Be sure to read the instructions for each exercise carefully. Here is a guide to running the Python tests on Exercism.
For each exercise, follow the instructions on Exercism to upload your solution. You will then need to mark it as complete. At that point you will be given the option to publish it. You must publish your solution in order to submit your work.
If you get through all four of these, please continue with other exercises that seem interesting or fun to you. There are lots to choose from!
How to submit your work
List the urls for your completed problems in a gist on GitHub. A gist is a like a short form repo that you can create directly on GitHub. See this guide for more detail on creating gists.
You should have several Exercism URLs listed in your gist, and they should look like this:
https://exercism.org/tracks/python/exercises/two-fer/solutions/yourexercismusername
You should have ONE gist URL, and it should look like this:
https://gist.github.com/amygori/29f631f9d5dd53d9c685db0e2d17678f
☝️ The above example is formatted with Markdown but it’s fine to use plain text (.txt
) for your gist if you’d rather.
To submit your work, paste the URL for your gist into this form.
🔖 Resources
RealPython: Basic Python Tutorials
These articles are way more in-depth than you need right now, but they are good references for more information, if you feel you need that.
- Basic Data Types
- Variables
- Operators and Expressions
- Strings
- Python Program Lexical Structure
- Conditional Statements
- While Loops
- For Loops
- Basic Input and Output
- String Formatting
- Defining Your Own Python Function
- Docstrings in Python
Other Python Resources
- LearnPython Tutorial -> A good reference with examples and exercises.
- A Byte of Python -> Use this as a reference, starting at First Steps. DO NOT follow the installation instructions to download Python – you already have Python installed!
- Official Python docs
- The Python Standard Library
- bpython
📓 Jupyter Notebooks
- RealPython: Using Jupyter Notebooks (video)
- RealPython: Jupyter Notebook: an Introduction
- Setting Up Your Python Development Environment: Jupyter Notebooks section
Asking Questions + Getting Help
- Julia Evans, How To Ask Good Questions
- Our Student Guidelines: Getting Help
- Rukia Sheikh-Mohamed, 5 Steps to Getting Unstuck
🦉 Code & Notes
- Notes
- Intro to Python notebooks (Notebooks 1-5)