Code Monkey home page Code Monkey logo

pythontrainingexercises's Introduction

Python Exercises
===================

In all cases the problem is stated in the top of the code which is for you to
edit. A solution is given, usually in the solution sub-package.

Requirements
------------
These should all work with any modern version of Python (2.7 of 3.2+).

It is best if you have pytest [http://pytest.org/latest/] installed but it is not essential.

Beginners:
---------

Strings:
In the strings/strings.py there are a series of string manipulation problems.
The solutions are in strings/solution/strings.py

Functions:
Create an equivalent of the builtin functions filter and map.
The problem is stated in Functions/Functions.py
A solution is given in Functions/solution/Functions.py

Classes:
Create a class that represents a distance that can be coverted form one measure
of units to another.
The problem is stated in ClassLength/Length.py
A solution is given in ClassLength/solution/Length.py

Dictionaries
Given a dictionary that maps state name to state capital how do you do the
reverse i.e. state capital to state name.
The problem is stated in DictOfStateCapitals/StateCapitals.py
A solution is given in DictOfStateCapitals/solution/StateCapitals.py

Intermediate:
-------------

Files:
Find duplicate files on the file system.
The problem is stated in DuplicateFiles/DuplicateFiles.py
A solution is given in DuplicateFiles/solution/DuplicateFiles.py

Dictionaries:
Use a dictionary to create a histogram of floating point numbers and print it
out in a visual way.
The problem is stated in Histogram/DictHistogram.py
A solution is given in Histogram/solution/DictHistogram.py

Generators:
Create a generator that creates the infinite geometric series:
1, 1/2, 1/4, 1/8... then sums the first N values or the values
until they are smaller than epsilon.
The problem is stated in Generators/Generator.py
A solution is given in Generators/solution/Generator.py

Markov Chain:
Create a class that can represent a MarkovChain
https://en.wikipedia.org/wiki/Markov_chain
The problem is stated in MarkovChain/MarkovChain.py
A solution is given in MarkovChain/solution/MarkovChain.py

Random Words:
Write a function that randomises letters in words after the first N letters.
The problem is stated in RandomWords/RandomWords.py
A solution is given in RandomWords/solution/RandomWords.py

Regular Expressions:
Parse a list of lines and use regular expressions to process
them differently according to what they contain.
The problem is stated in RegexMapping/RegexMap.py
A solution is given in RegexMapping/solution/RegexMap.py


Advanced:
---------

Co-routines:
Write a co-routine that is sent words and maintains a sorted list of them.
The problem is stated in Generators/CoRoutine.py
A solution is given in Generators/solution/CoRoutine.py

Decorators:
Write a decorator that makes sure that only a particular type of exception is
raised by the function.
The problem is stated in Decorators/Decorators.py
A solution is given in Decorators/solution/Decorators.py

Create a strategy:
Given the text for Romeo and Juliet can you predict which actor is next to speak?
The problem is stated in RomeoAndJuliet/romeo_and_juliet.py
A solution is given in RomeoAndJuliet/solution/romeo_and_juliet.py


Created by Paul Ross <[email protected]>

2015-11-04

Licence: BSD3 # Source: https://opensource.org/licenses/BSD-3-Clause

pythontrainingexercises's People

Contributors

burrowsa avatar davidsheldon avatar paulross avatar smootoo avatar tomtaylorlondon avatar wilfred avatar

Watchers

 avatar  avatar  avatar

Forkers

steliord

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.