Git Product home page Git Product logo

python-modules-and-scripts's Introduction

1. Writing Python modules and scripts the right way

Welcome to the first session of Coding Club!

In this session, we will be looking at how to clean up your Python code into scripts and modules. This will make your work easy to use and distribute, both for yourself and others!

The slides are available here.

Fire up a GitHub Codespace from this repository to test out the examples in realtime. You can hit the + sign in the top right hand corner of GitHub, and select "New Codespace", then search for this repository, under jacanchaplais/python-modules-and-scripts. This will give you a virtual machine in the cloud which you can use to follow along with. Code examples are stored under src/.

Bonus exercises

Starting from the src/6_installable/wavey/ directory:

  1. Add a new wave function to __init__.py (eg. tan_wave())
    • Be sure to document the function
  2. Edit generate() function in __main__.py options:
    1. Add an option to select which wave form to use (if you did ex 1)
    2. Edit --noise option so that it takes a numerical value, to allow the scale of the noise to be set in the CLI
    3. Add an option to select the interval of angles data is created for
  3. Add option to plot() function to change the line style of the figure

python-modules-and-scripts's People

Contributors

jacanchaplais avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.