intro-to-python
intro-to-python copied to clipboard
An Introduction to Programming in Python
Step 1: Fork the "upstream" repo. This creates an "origin" repo under your own control. Step 2: Clone the forked repo. Step 3: Add "upstream" remote address Step 4: Checkout...
How to customize CSS and JS? Create a /static directory and then insert home.css and home.js and then load them like: ```html {% extends "bootstrap_layout.html" %} {% set active_page =...
Some students have asked about grammar / spell-check style red squiggles in their vs code text editor. This is due to pylint not being configured properly. To fix we can...
Including how to save files, FTI about "backends", using in notebooks etc. ```py plt.scatter(_____) plt.title("_____") plt.xlabel("______") plt.ylabel("______") plt.savefig(img_filepath) plt.show() ```
Style-checking: + https://pypi.org/project/autopep8/ + http://pep8online.com/ + https://codeclimate.com/ ```sh pip install autopep8 ``` make a commit, then... ```sh autopep8 --in-place --aggressive --recursive . ```
+ https://docs.python.org/3/library/pickle.html ```py import os import pickle class Team() # ... FILEPATH = os.path.join(os.path.dirname(__file__), "..", "my", "my-team.pkl") def save_it(): team = Team() print("SAVING...") with open(FILEPATH, "wb") as f: pickle.dump(team, f)...
Some students were asking for a list of common errors, like what do I do when I see "TypeError: list indices must be integers or slices, not str"
Add links to the notes, with example code: + https://plotly.com/python/maps/ + https://plotly.com/python/scattermapbox/ ```py import os import plotly.graph_objects as go from dotenv import load_dotenv load_dotenv() MAPBOX_ACCESS_TOKEN = os.getenv("MAPBOX_ACCESS_TOKEN") fig = go.Figure(go.Scattermapbox(...
Before assigning this project again: + add requirement that packages should be installed via requirements.txt + update / clarify README requirements, explicitly mentioning it in the evaluation rubric + update...
... in the Chart Gallery exercise. Some students were seeing scientific notation to represent the large numbers. And said they were able to solve this with code like: ```py plt.gcf().axes[0].xaxis.get_major_formatter().set_scientific(False)...