Category: python
Scripting languages are relatively slow compared to native languages e.g. C/C++. Therefore, it is often needed to identify the performance bottlenecks of the code. In , the timeit function …
The problem is from codeforces http://codeforces.com/problemset/problem/221/B The problem statement is clear. The answer is to count the number of divisors that has at least one common digit with the …
In , the euclidean algorithms i.e. gcd and lcm are presented. Especially the gcd function, which computes the greatest common divisor, is fundamentally important in math and can be …
Python offers a module urllib and its advanced version urllib2 to allow downloading files from given URLs. The following shows three different ways to access the internet data. #!/usr/bin/env …
Python provides a module timeit which allows quick timing of a piece of code. The straightforward example is given below. import timeit bar = timeit.Timer("a += 1", "a = …