Exercism exercises in Python.

Overview

👋 Thank you for your interest in contributing to the exercism Python track!

⚠️ Please Note ⚠️

We are currently in the middle of re-arranging and re-configuring our track for exercism V3.

We're super-excited 🎉 🚀 -- and we really want you to be involved! -- but all that inital configuration work means our maintainers can't accept unsolicited contributions at this time.

Please check our issue list for tasks we've flagged as [help wanted] -- and check back -- we'll be adding (many more!) tasks with that flag in the coming weeks as we update our documentation and identify exercises, documents, and bugs that need to be worked on before our V3 launch.


Exercism Python Track

Build Status Join the chat at https://gitter.im/exercism/python

Exercism exercises in Python

Contributing Guide

Our WIP V3 documentation can be found here: exercism V3.

Testing

All exercises must be compatible with Python version 3.8 upwards. We no longer support Python 2.x.

To test a single exercise:

python3 test/check-exercises.py [exercise-name]

To test all exercises:

python3 test/check-exercises.py

Code Style

The Python code in this repo is meant to follow the PEP8 style guide (a stylized version http://pep8.org).

This repo uses flake8 with default settings to enforce the coding standard.

CI build

License

This repository uses the MIT License.

Comments
  • Recruiting additional maintainers for Python

    Recruiting additional maintainers for Python

    We're about to start a big push towards version 3 (v3) of Exercism. This is going to be a really exciting step forward for Exercism, with in-browser coding, new Concept Exercises with automated feedback, improved mentoring and much more.

    This to be a big community effort, with the work spread out among hundreds of volunteers across Exercism. One key thing is going to be each track having enough maintainers who have the time to manage that community effort. We are therefore putting out a call for new maintainers to bolster our numbers. We're hoping that our existing maintainers will be able to act as mentors to the newer maintainers we add, and take on a parental role in the tracks.

    If you are an existing maintainer, could you please reply to this letting us know that you think you'll have time (2-3hrs/week) to help with this over the next 6 months. If you won't have that time, but still want to be a maintainer and just help where you can instead, please tell us that too. If you have come to the end of the road as a maintainer, then we totally understand that and appreciate all your effort, so just let us know.

    For anyone new who's interested in becoming a maintainer, thanks for your interest! Being an Exercism maintainer is also a great opportunity to work with some other smart people, learn more about your language of choice, and gain useful skills and experience that are useful for growing your career in the technical leadership direction. Please write a comment below introducing yourself along with your Exercism handle, and telling us why you're interested in becoming a maintainer, and any relevant experience. We will then evaluate every application and contact you using your exercism email address once we have finished the evaluation process.

    Thank you!

    See also https://github.com/exercism/exercism/issues/5161

    opened by kytrinyx 30
  • 🤖 Add authors and contributors to Practice Exercises

    🤖 Add authors and contributors to Practice Exercises

    If you got tagged in this PR, it is because you are being credited for work you've done in the past on Exercism here, and we want to ensure you don't miss out on the recognition you deserve 🙂


    With v3, we've introduced the idea of exercise authors and contributors. This information is stored in the exercises' .meta/config.json files (see the docs).

    Concept Exercises, which are all new, already contain authors and contributors. Practice Exercises though are missing this information. In this PR, we attempt to populate the authors and contributors of Practice Exercises based on their commit history.

    Maintainer TODO list

    These are the things you, the maintainers, should do:

    • [ ] Check the authors and contributors, adding/removing users where the data is missing or incorrect
    • [ ] Double-check any renamed Practice Exercises
    • [ ] Check for Practice Exercises with missing authors, which are most likely due to the author not being on GitHub anymore
    • [ ] Add additional authors if you know that a Practice Exercise has actually been created by more than one author

    For clarity, authors should be the people who originally created the exercise on this track. Contributors should be people who have substantially contributed to that exercise. PRs for typos or multiple-exercise PRs do not automatically mean someone should be considered a contributor to that exercise. Those non-exercise-specific contributions will get recognition through Exercism's reputation system in v3.

    If you find something needs updating, just push a new commit to this PR.

    Automatic Merging

    We will automatically merge this PR before we launch v3, but will give the maximum time we can to maintainers to review it first.


    The rest of this issue explains how this PR has been generated. You do not need to read it.

    Algorithm

    We start out by looking at the current Practice Exercises. For each Practice Exercise, we'll look at the commit history of its files to see which commits touched that Practice Exercise. How renames are handled is discussed in the "Renames" section later in this document.

    Any commit that we can associate with a Practice Exercise is used to determine authorship/contributorship. Here is how we assign authorship/contributorship:

    Authors

    1. Find the Git commit author of the oldest commit linked to that Practice Exercise.
    2. Find the GitHub username for the Git commit author of that commit
    3. Add the GitHub username of the Git commit author to the authors key in the .meta/config.json file

    Contributors

    1. Find the Git commit authors and any co-authors of all but the oldest commit linked to that Practice Exercise. If there is only one commit, there won't be any contributors.
    2. Exclude the Git commit author and any co-authors of the oldest commit from the list of Git commit authors (an author is not also a contributor)
    3. Find the GitHub usernames for the Git commit authors and any co-authors of those commits
    4. Add the GitHub usernames of the Git commit authors and any co-authors to the contributor key in the .meta/config.json file

    We're using the GitHub GraphQL API to find the username of a commit author and any co-authors. In some cases though, a username cannot be found for a commit (e.g. due to the user account no longer existing), in which case we'll skip the commit.

    Renames

    There are a small number of Practice Exercises that might have been renamed at some point. You can ask Git to "follow" a file over its renames using git log --follow <file>, which will also return commits made before renames. Unfortunately, Git does not store renames, it just stores the contents of the renamed files and tries to guess if a file was renamed by looking at its contents. This can (and will) lead to false positives, where Git will think a file has been renamed whereas it hasn't. As we don't want to have incorrect authors/contributors for exercises, we're ignoring renames. The only exception to this are known exercise renames:

    • bracket-push was renamed to matching-brackets
    • retree was renamed to satellite
    • resistor-colors was renamed to resistor-color-duo
    • kindergarden-garden was renamed to kindergarten-garden

    If you know of a rename of a Practice Exercise, please check to see if its authors and contributors are correctly set.

    Exclusions

    There are some commits that we skip over, which thus don't influence the authors/contributors list:

    • Commits authored by dependabot[bot], dependabot-preview[bot] or github-actions[bot]
    • Bulk update PRs made by ErikSchierboom or kytrinx to update the track

    Tracking

    https://github.com/exercism/v3-launch/issues/24


    cc @0xae, @aaditkamat, @abhijitparida, @aboutroots, @AbstractBeliefs, @acedrew, @ackerleytng, @aes421, @AiryShift, @akashsara, @aldraco, @Alexhans, @alexpjohnson, @alirezaghey, @AnAccountForReportingBugs, @AndrejTS, @anunciado, @ariso353, @atg-abhishek, @austinlyons, @beatorizu, @behrtam, @betegelse, @BethanyG, @betojulio, @bsoyka, @c4llmeco4ch, @carloscdias, @chgraef, @chrisftw, @cjchallis, @clapmyhands, @cmccandless, @cptjackson, @crazymykl, @crsmi, @cruxicheiros, @csabella, @ctholho, @cypher, @danishprakash, @davepeake, @de2Zotjes, @deep110, @denislooby, @dmerejkowsky, @DocFogel, @Dog, @dotrungkien, @dvermd, @ee7, @elyashiv, @elyssonmr, @emerali, @etmoore, @etrepum, @ferhatelmas, @flores-jacob, @fluxusfrequency, @forgeRW, @fortrieb, @frerich, @gabriel376, @gabriellhrn, @Galixxon, @GascaK, @GKotfis, @Grociu, @gsbullmer, @guaneec, @guygastineau, @hanksudo, @hariesramdhani, @hebertjulio, @helenst, @henrik, @hop, @iandexter, @ikhadykin, @ikkebr, @ilmanzo, @jackattack24, @jamesmcm, @jandersoncampelo, @janetriley, @jeremystucki, @jesserizzo, @jgomo3, @jnaulty, @josix, @jremmen, @JuliaKBremer, @julianandrews, @junming403, @justani, @K4cePhoenix, @koljakube, @kotp, @krapes, @kylecjo, @kytrinyx, @lekum, @lemoncurry, @lowks, @luanjpb, @lucasdpau, @lucasloisp, @luoken, @magnus-hogberg, @mambocab, @mandel01, @markijbema, @MartinDelille, @michaelem, @michaelkunc, @miketamis, @mikeyny, @Mofeywalker, @MojitoMonday, @morganpartee, @mostlybadfly, @mpatibandla, @MrNaif2018, @mtroiani, @N-Parsons, @n1k0, @nikamirrr, @Nishant23, @nithin-vijayan, @njgingrich, @nmbrgts, @NobbZ, @oalbe, @olufotebig, @omer-g, @Oniwa, @orozcoadrian, @pamtdoh, @parinporecha, @parthsharma2, @PatrickMcSweeny, @patricksjackson, @Paul-Ilyin, @Peque, @peterblazejewicz, @petertseng, @pheanex, @pranasziaukas, @pyropy, @pywkm, @rever0f, @rfuentescruz, @rivergillis, @rjsabatini, @RJTK, @roadfoodr, @robkeim, @rodrigocam, @rohitrango, @rootulp, @rozuur, @rpalo, @sambryant4, @samdec11, @samwincott, @saurabhchalke, @sdublish, @sharno, @siejqa, @simmol, @sjakobi, @sjwarner-bp, @skeskali, @smalley, @smt923, @spencer51324312, @Stigjb, @stonemirror, @subkrish, @Sukhj1nder, @sukovanej, @susg, @thenigan, @thomasjpfan, @tqa236, @trangttt, @treyhunner, @tsamoglou, @tstirrat15, @twsh, @vgerak, @vigneshhari, @wandreuscv, @wobh, @xarxziux, @xitanggg, @yawpitch, @yo-ga, @yunchih, @YuriyCherniy, @ZacharyRSmith, @zwaltman as you are referenced in this PR

    x:size/tiny 
    opened by ErikSchierboom 26
  • Moved the exercises to the folder exercises/

    Moved the exercises to the folder exercises/

    As issue #282 stated, I moved the exercises to an exercises/ folder.

    I decided to do this in a different branch in order to avoid this pull request being mixed in with the other one I made yesterday about doc files (since they were actually two but GH merged them into a single one).

    If this is not a good practice please let me know, I'm not that experienced in contributing to projects.

    opened by oalbe 25
  • OLD `functools` Module Concept Exercise

    OLD `functools` Module Concept Exercise

    This issue describes how to implement the functools concept exercise for the python track.

    Getting started

    Please please please read the docs before starting. Posting PRs without reading these docs will be a lot more frustrating for you during the review cycle, and exhaust Exercism's maintainers' time. So, before diving into the implementation, please read up on the following documents:

    Goal

    This concept exercise is meant to teach an understanding/use of functools (e.g, the functools module) in Python.

    Learning objectives

    Learn more about the functional tools the Python Standard Library provides through the functools module. Build and understanding of and use the following methods and decorators from the module:

    • functools.partial()
      • partial.func
      • partial.args
      • partial.keywords
    • functools.update_wrapper()
    • functools.cache()
    • ~~@functools.cached_property()~~ (this seems better in class_customization)
    • @functools.lru_cache()
    • ~~@functools.total_ordering~~ (this method seems more appropriate in the rich comparisons exercise)
    • @functools.singledispatch
      • @<function>.register()
    • @functools.wraps()
    • class functools.partialmethod()
    • class functools.singledispatchmethod()

    Out of scope

    • classes & class customization beyond the direct use of the class methods in this module.
    • comprehensions
    • comprehensions in lambdas
    • decorators (these have their own exercise. See issue #2356 )
    • map(), filter() or functools.reduce() in a comprehension
    • functools.reduce()(this was already covered with map() and filter())
    • generators
    • using an assignment expression or "walrus" operator (:=) in a lambda
    • class decorators beyond the ones described in this module.
    • enums

    Concepts

    • functional tools in python
    • functools module
    • generic functions
    • decorators
    • higher-order functions
    • partial objects in python/partial evaluation in python
    • single dispatch

    Prerequisites

    These are the concepts/concept exercises the student needs to complete/understand before solving this concept exercise.

    • basics
    • bools
    • classes
    • class-customization
    • class-components
    • comparisons
    • rich-comparisons
    • decorators
    • descriptors
    • dicts
    • dict-methods
    • functions
    • function-arguments
    • higher-order-functions
    • iteration
    • lists
    • list-methods
    • numbers
    • sequences
    • sets
    • strings
    • string-methods
    • tuples

    Resources to refer to

    • Hints

      For more information on writing hints see hints

      • You can refer to one or more of the resources linked above, or analogous resources from a trusted source. We prefer using links within the Python Docs as the primary go-to, but other resources listed above are also good. Please try to avoid paid or subscription-based links if possible.
    • links.json

      For more information, see concept links file

      • The same resources listed in this issue can be used as a starting point for the concepts/links.json file, if it doesn't already exist.
      • If there are particularly good/interesting information sources for this concept that extend or supplement the concept exercise material & the resources already listed -- please add them to the links.json document.

    Concept Description

    Please see the following for more details on these files: concepts & concept exercises

    • Concept about.md

      Concept file/issue: The working copy of these files can be found here: functools docs. These may need editing to match the exercise writers needs/style.

      For more information, see Concept about.md

      • This file provides information about this concept for a student who has completed the corresponding concept exercise. It is intended as a reference for continued learning.
    • Concept introduction.md

      For more information, see Concept introduction.md

      • This can also be a summary/paraphrase of the document listed above, and will provide a brief introduction of the concept for a student who has not yet completed the concept exercise. It should contain a good summation of the concept, but not go into lots of detail.
    • Exercise introduction.md

      For more information, see Exercise introduction.md

      • This should also summarize/paraphrase the above document, but with enough information and examples for the student to complete the tasks outlined in this concept exercise.

    Exercise Metadata - Track

    For more information on concept exercises and formatting for the Python track config.json , please see concept exercise metadata. The track config.json file can be found in the root of the Python repo.

    You can use the below for the exercise UUID. You can also generate a new one via exercism configlet, uuidgenerator.net, or any other favorite method. The UUID must be a valid V4 UUID.

    • Exercise UUID : ``
    • concepts should be filled in from the Concepts section in this issue
    • prerequisites should be filled in from the Prerequisites section in this issue

    Exercise Metadata Files Under .meta/config.json

    For more information on exercise .meta/ files and formatting, see concept exercise metadata files

    • .meta/config.json - see this link for the fields and formatting of this file.
    • .meta/design.md - see this link for the formatting of this file. Please use the Goal, Learning Objectives,Concepts, Prerequisites and , Out of Scope sections from this issue.

    Implementation Notes

    • Code in the .meta/examplar.py file should only use syntax & concepts introduced in this exercise or one of its prerequisite exercises.
    • Please do not use comprehensions, generator expressions, or other syntax not previously covered. Please also follow PEP8 guidelines.
    • In General, tests should be written using unittest.TestCase and the test file should be named <EXERCISE-NAME>_test.py.
    • While we do use PyTest as our test runner and for some implementation tests, please check with a maintainer before using a PyTest test method, fixture, or feature.
    • Our markdown and JSON files are checked against prettier . We recommend setting prettier up locally and running it prior to submitting your PR to avoid any CI errors.

    Help

    If you have any questions while implementing the exercise, please post the questions as comments in this issue, or contact one of the maintainers on our Slack channel.

    opened by BethanyG 24
  • Should this track use test generators?

    Should this track use test generators?

    Pros:

    • Consistent test format
    • (Generally) Much easier to add new tests from the canonical data

    Cons:

    • Some exercises don't have canonical data (although this number is shrinking rapidly)
    • Creation of test generators for new exercises/exercises without generators can be more complicated than even implementing the exercise itself.

    Discussion commence... now.


    TL;DR:

    • Test generators are (probably) a good idea
    • Use Jinja2 templates for code generation
    • Support exercise-specific templates.
    opened by cmccandless 24
  • Function in templates should have parameters?

    Function in templates should have parameters?

    I feel better if I have the parameters in template (maybe because I'm used to it from other sites). When I've been solving first problem with input I didn't knew how I'm supposed to get input. I had to look in the tester script.

    opened by JanKaifer 24
  • [Ghost Gobble Arcade Game]: Stub Notes are Confusing

    [Ghost Gobble Arcade Game]: Stub Notes are Confusing

    Should be mentions of "If Else statements in the readme because the Boolean expressions are a red herring. You cannot solve anything by setting the value to true or false.

    opened by Crucibl 23
  • Skip all but the first test.

    Skip all but the first test.

    This change adds a skip to all but the first test for every problem set in order to avoid overwhelming the users with a bunch of failed test.

    This approach is the same as how the Ruby tests have been implemented, which encourages a pseudo TDD style to solving the exercises.

    opened by dkinzer 23
  • [WIP] Add Python test generator

    [WIP] Add Python test generator

    First pass that actually functions; there's definitely going to be some need for additional passes at the work of converting the canonical input dict to arguments that can be passed to Python functions; the canonical data is all over the place from exercise to exercise, and simply treating the dict as keyword arguments doesn't work well because quite a few exercises use keys that are legal dict keys but illegal keyword arguments (ie numbers, language reserved words).

    But I think this is a decent start for Hacktoberfest.

    opened by yawpitch 22
  • [New Concept]: Decorators

    [New Concept]: Decorators

    Adds concept / concept exercise for #2356. This is in a WIP state and is up for any feedback to come in earlier!

    Notes:

    • error messages have been designed in line with python 3.9. I believe the error messages in question have not been changed between 3.6 and 3.9. I am aware that 3.10 changed many error messages, but I do not know whether the ones used in this concept have been changed. If you would like me to check/update these to be inline with 3.10 then please say! (I chose 3.9 as it is the version currently used by the test runner and I believe that 3.8, which the track itself uses, doesn't make a difference anyway.

    In line with the above, should I be basing code samples off 3.8 or 3.9? (I assume when the track updates code samples would have to be updated to)

    I will edit this as I add things that are useful to note and when I mark this PR as ready for review!

    x:size/large 
    opened by mathstrains21 21
  • Skeleton files should be included in all problems to make it easier

    Skeleton files should be included in all problems to make it easier

    I'm on the Python section, and I've found that only a few challenges include a skeleton file. This is helpful, since you can then start coding without the delay of creating your own file. Example: the Bob challenge comes with bob.py:

    #
    # Skeleton file for the Python "Bob" exercise.
    #
    
    
    def hey(what):
    
        return
    

    It'd be great if a skeleton file like this was included in all of the challenges, to make things just a little bit easier for everyone.

    opened by gytdau 21
  • [Plane_ticket & generator]: improvments

    [Plane_ticket & generator]: improvments

    This pr is meant to improve the unreleased exercise "plane ticket" and its concept to achieve a better state.

    As of this has the following changes been made:

    • Changed the code format.
    • Changed the link formating

    What is left:

    • Add an introduction for the exercise
    • Add/improve hints
    • Add a blurb for the concept
    • Various improvements for the exercise and concept
    opened by meatball133 1
  • [Numbers]:  Rethink/Redesign Second  Round

    [Numbers]: Rethink/Redesign Second Round

    We're opening this issue to address problems with our two Numbers concept exercises, Currency Exchange and Electric Bill.

    The Challenge: Come up with something better

    Please use this issue to propose rewrites | restructuring | changes in story to one or the other of these exercises, along with any revisions you'd make to the numbers concept itself. Feel free to link to a PR for these suggestions. Keep in mind the PR will be auto-closed, but we will reopen any PRs that propose solid solutions to our issues. Our ultimate goal is to get either or both exercises to a state where we can all be comfortable / happy with them as numbers concept exercises for the track.

    We don't want suggestions on re-working our concept tree or how teach math. We are also very aware of typos, mistakes, and spelling errors. While correcting them is important, that's not what we want here

    Instead, we'd like to know what you would do to fulfill the requirements of writing this numbers concept exercise in a way that doesn't raise significant complaints, create confusion for students on the Python track, and is consistent with the intent of concept exercises, and their requirements. Keep in mind that this is the 2nd or 3rd exercise for the track, and many features of Python cannot be used at this stage, including other modules, loops, comprehensions, lists, tuples, sets, and so forth.

    We are also not (at this time) interested in copying another tracks exercise, story or concept. We're interested is solving the issues with what we currently have.

    Thank you very much for your ideas and support! 🌟

    opened by BethanyG 0
A collection of simple python mini projects to enhance your python skills

A collection of simple python mini projects to enhance your python skills

PYTHON WORLD 12.1k Jan 5, 2023
Python Eacc is a minimalist but flexible Lexer/Parser tool in Python.

Python Eacc is a parsing tool it implements a flexible lexer and a straightforward approach to analyze documents.

Iury de oliveira gomes figueiredo 60 Nov 16, 2022
Repository for learning Python (Python Tutorial)

Repository for learning Python (Python Tutorial) Languages and Tools ?? Overview ?? Repository for learning Python (Python Tutorial) Languages and Too

Swiftman 2 Aug 22, 2022
A python package to avoid writing and maintaining duplicated python docstrings.

docstring-inheritance is a python package to avoid writing and maintaining duplicated python docstrings.

Antoine Dechaume 15 Dec 7, 2022
advance python series: Data Classes, OOPs, python

Working With Pydantic - Built-in Data Process ========================== Normal way to process data (reading json file): the normal princiople, it's f

Phung Hưng Binh 1 Nov 8, 2021
A comprehensive and FREE Online Python Development tutorial going step-by-step into the world of Python.

FREE Reverse Engineering Self-Study Course HERE Fundamental Python The book and code repo for the FREE Fundamental Python book by Kevin Thomas. FREE B

Kevin Thomas 7 Mar 19, 2022
A simple USI Shogi Engine written in python using python-shogi.

Revengeshogi My attempt at creating a USI Shogi Engine in python using python-shogi. Current State of Engine Currently only generating random moves us

null 1 Jan 6, 2022
Python-slp - Side Ledger Protocol With Python

Side Ledger Protocol Run python-slp node First install Mongo DB and run the mong

Solar 3 Mar 2, 2022
Python-samples - This project is to help someone need some practices when learning python language

Python-samples - This project is to help someone need some practices when learning python language

Gui Chen 0 Feb 14, 2022
Valentine-with-Python - A Python program generates an animation of a heart with cool texts of your loved one

Valentine with Python Valentines with Python is a mini fun project I have coded.

Niraj Tiwari 4 Dec 31, 2022
A curated list of awesome tools for Sphinx Python Documentation Generator

Awesome Sphinx (Python Documentation Generator) A curated list of awesome extra libraries, software and resources for Sphinx (Python Documentation Gen

Hyunjun Kim 831 Dec 27, 2022
API Documentation for Python Projects

API Documentation for Python Projects. Example pdoc -o ./html pdoc generates this website: pdoc.dev/docs. Installation pip install pdoc pdoc is compat

mitmproxy 1.4k Jan 7, 2023
🏆 A ranked list of awesome python developer tools and libraries. Updated weekly.

Best-of Python Developer Tools ?? A ranked list of awesome python developer tools and libraries. Updated weekly. This curated list contains 250 awesom

Machine Learning Tooling 646 Jan 7, 2023
Run `black` on python code blocks in documentation files

blacken-docs Run black on python code blocks in documentation files. install pip install blacken-docs usage blacken-docs provides a single executable

Anthony Sottile 460 Dec 23, 2022
Legacy python processor for AsciiDoc

AsciiDoc.py This branch is tracking the alpha, in-progress 10.x release. For the stable 9.x code, please go to the 9.x branch! AsciiDoc is a text docu

AsciiDoc.py 178 Dec 25, 2022
📖 Generate markdown API documentation from Google-style Python docstring. The lazy alternative to Sphinx.

lazydocs Generate markdown API documentation for Google-style Python docstring. Getting Started • Features • Documentation • Support • Contribution •

Machine Learning Tooling 118 Dec 31, 2022
A Python module for creating Excel XLSX files.

XlsxWriter XlsxWriter is a Python module for writing files in the Excel 2007+ XLSX file format. XlsxWriter can be used to write text, numbers, formula

John McNamara 3.1k Dec 29, 2022
API spec validator and OpenAPI document generator for Python web frameworks.

API spec validator and OpenAPI document generator for Python web frameworks.

1001001 249 Dec 22, 2022
Materi workshop "Light up your Python!" Himpunan Mahasiswa Sistem Informasi Fakultas Ilmu Komputer Universitas Singaperbangsa Karawang, 4 September 2021 (Online via Zoom).

Workshop Python UNSIKA 2021 Materi workshop "Light up your Python!" Himpunan Mahasiswa Sistem Informasi Fakultas Ilmu Komputer Universitas Singaperban

Eka Putra 20 Mar 24, 2022