This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Problem solution | |
---------------- | |
The area of a circular ring is: | |
pi * (R^2 - r^2) | |
where R is the radius of the bigger circle and r | |
the radius of the other one. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test/Spec.hs:57:44: | |
Couldn't match type ‘m’ with ‘Pipes.Safe.SafeT IO’ | |
‘m’ is a rigid type variable bound by | |
the type signature for | |
shouldReturnP :: (MonadIO m, MonadSafe m) => | |
IO (Producer FilePath m ()) -> [FilePath] -> Expectation | |
at test/Spec.hs:53:18 | |
Expected type: Producer FilePath (Pipes.Safe.SafeT IO) () | |
Actual type: Producer FilePath m () | |
Relevant bindings include |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
group: esempio alberghi | |
Cliente = { CodC, NomeC | |
1, Mario | |
2, Giuseppe | |
3, Laura | |
4, Angela | |
} | |
Albergo = { CodA, NomeA, Comune, NumStelle:number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from paramunittest import * | |
@parametrized((1, 2)) | |
class TestLess(ParametrizedTestCase): | |
def setParameters(self, a, b): | |
self.a = a | |
self.b = b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
from paramunittest import * | |
@parametrized( | |
('1', '2'), | |
) | |
class TestFoo(ParametrizedTestCase): | |
def setParameters(self, a, b): | |
self.a = a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ls hammock/dist/ | |
hammock-0.1.0-py27-none-any.whl | |
$ pip install hammock --no-index --find-links file:///home/miki/exp/hammock/dist | |
Ignoring indexes: http://pypi.python.org/simple/ | |
Downloading/unpacking hammock | |
Requirement already satisfied (use --upgrade to upgrade): requests>=0.13.6 in ./lib/python2.7/site-packages/requests-0.13.6-py2.7.egg (from hammock) | |
Installing collected packages: hammock | |
Successfully installed hammock | |
Cleaning up... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import itertools | |
import collections | |
def sum_column(data): | |
return sum(zip(*data)[1], 0.0) | |
def split_groups(sensors): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Split a long number in batches. | |
>>> k = 178684461669052552311410692812805706249615844217278044703496837914086683543763273909969771627106004287604844670397177991379601L | |
>>> print pretty(k) | |
17868446 16690525 52311410 69281280 57062496 15844217 27804470 34968379 | |
14086683 54376327 39099697 71627106 00428760 48446703 97177991 379601 | |
>>> print pretty(k, 3, 9) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1964 function calls in 0.024 seconds | |
Ordered by: standard name | |
ncalls tottime percall cumtime percall filename:lineno(function) | |
1 0.000 0.000 0.024 0.024 <string>:1(<module>) | |
2 0.000 0.000 0.000 0.000 clock.py:121(_hash) | |
2 0.000 0.000 0.000 0.000 clock.py:135(__init__) | |
1 0.000 0.000 0.000 0.000 clock.py:159(get_callback) | |
1 0.000 0.000 0.000 0.000 clock.py:178(release) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import poly | |
import operator | |
import fractions | |
import functools | |
import itertools | |
def is_root(p, k): | |
''' | |
True if k is a root of the polynomial p, False otherwise. |