Euler Project: Problem 10 – Python

This weeks covering of the Euler Project: Problem 10 Asks us to simply: Find the sum of all primes below 2 million. Were going to take almost the entire solution for this from our solution to problem 7, where we start out with a generator function to produce our prime numbers, and then use a [...]

Euler Project: Problem 9 – Python

The Euler Project has been a fun way to examine how well we know our programming language of choice. Today we’re covering problem 9 which reads as follows: A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a^2 + b^2 = c^2 For example, 3^2 + 4^2 [...]

Euler Project: Problem 7 – Python

Welcome to this installment of the Euler Project in python. Today we cover problem 7 which asks this question: By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10,001st prime number? For this one we’ll create a prime [...]

Euler Project: Problem 6 – Python

Today’s coverage of the Euler Project looks at problem 6. This is a simple and sweet solution, meaning a short post, meaning less of that magical insight that we strive so hard to provide. Problem 6 of Euler Project asks the following: The sum of the squares of the first ten natural numbers is: 12 [...]

Euler Project: Problem 5 – Python

Welcome to our discussion of Problem 5 of the Euler project. The Euler Project has been an interesting way to explore our understandings of the coding languages we thought we knew so well. Problem 5 inquires the following: 2520 is the smallest number that can be divided by each of the numbers from 1 to [...]

Euler Project: Problem 2 – Python

We have covered generator functions already, and I’ve actually used a variation of this problem as one of the examples doing so (less the only even numbers part). Anyways our second installment covering Problem 2 of the Euler Project series reads as follows: Each new term in the Fibonacci sequence is generated by adding the [...]

Euler Project: Problem 1 – Python

We’ll be starting a series covering the Euler Project found here today. Stay tuned for more updates as the beginning ones are quite simple, and of little real interest. Euler Project: Problem 1 reads as follows: If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, [...]

Check For Truncation In MySQL Table Using Python

I was writing a truncation checking script for specifically varchar column types the other day, thought I would share it, open up the floor for discussion on better methods for doing so, specifically regarding the MySQL portion devoted to determining longest length of current column. Its based on this little tidbit, as it has been [...]

Value Testing (True/False) In Python

I find it best to define value testing in python by what python considers False. At the end of this article are some simple code examples done in the python console to demonstrate a selection of the issues. Python will consider any of its container elements (),{},[] False if they are empty. Python also has [...]

Python List Comprehension

One of my favorite aspects of python is its capability for list comprehension. List comprehension as defined by the python docs. “Each list comprehension consists of an expression followed by a for clause, then zero or more for or if clauses. The result will be a list resulting from evaluating the expression in the context [...]