• Stars
    star
    254
  • Rank 154,312 (Top 4 %)
  • Language
    Python
  • License
    BSD 3-Clause "New...
  • Created over 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Code to exercise your Python knowledge.
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

More Repositories

1

dtale

Visualizer for pandas data structures
TypeScript
4,491
star
2

arctic

High performance datastore for time series and tick data
Python
3,031
star
3

ArcticDB

ArcticDB is a high performance, serverless DataFrame database built for the Python Data Science ecosystem.
C++
1,097
star
4

notebooker

Productionise & schedule your Jupyter Notebooks as easily as you wrote them.
Python
834
star
5

pytest-plugins

A grab-bag of nifty pytest plugins
Python
545
star
6

dapr-sidekick-dotnet

Dapr Sidekick for .NET - a lightweight lifetime management component for Dapr
C#
172
star
7

mdf

Data-flow programming toolkit for Python
Python
161
star
8

PyBloqs

Python
146
star
9

page-objects

Page Objects web testing pattern for Python
Python
127
star
10

pynorama

Natural Language Processing Visualization in Python
JavaScript
107
star
11

partialtesting

Run only the tests that are relevant for your changes
Python
74
star
12

jupyterlab-autoplot

Magical Plotting in JupyterLab
Python
63
star
13

okcli

An Oracle-DB command line client
Python
49
star
14

adaero

A platform for managing peer-to-peer feedback
Python
43
star
15

pkglib

Company-centric Python packaging and testing library
Python
39
star
16

prometheus-flashblade-exporter

Export metrics from Pure Storage FlashBlade to Prometheus
Go
29
star
17

openstack_load_leveller

Openstack Load Leveller / Load Balancer
Python
28
star
18

mockextras

Addon library for the python Mock library
Python
25
star
19

hubot-servicenow-tickets

a servicenow plugin for hubot
JavaScript
20
star
20

jenkins-blueprint-plugin

Build Jenkins projects according to a .jenkins.yml file in the repository.
Java
17
star
21

ftp-coredump

FTP core dump script and related Ansible roles
Shell
13
star
22

servicenow-lite

utility library for interacting with servicenow
JavaScript
11
star
23

hiveminder

Python
8
star
24

hexplode

Python
8
star
25

microbit

Information and examples about the BBC micro:bit
Python
5
star
26

pydata2022

3
star