Set Comprehension in Python

In a previous article I discussed list comprehensions. Today I will talk about set comprehensions. Set comprehensions were added to Python in version 2.7 and they are similir to List Comprehensions, the only difference is that we use curly braces instead of square brackets when making them. A set is an un-ordered collection in which … 

 

Python List Comprehensions

A special syntax form in the Python language is the list comprehension. List comprehensions allow programmers to make their code more compact and (sometimes) harder to read if they push the comprehensions too far! The syntax consists of an expression in square brackets to create a new list. In order to show the beauty of … 

 

The python lambda

Recently I learned how to use the lambda function, a simple, unbound one liner function. A lambda is similar to a normal Python function, the only difference is in the way it is used. The example below will explain better: The poww function defined above takes an argument x and squares it. So if we … 

 

The new Unit Conversion App

A few weeks ago I blogged about a unit conversion app that I was working on. I doubt that I’ll be working on that project anymore. I found on github a similar project that was written better than mine(its design is modular, the style is clean and just better than my own) but the said … 

 

Python 101: Your first python program

This post is part 2 of Get started with Python programming series, in which I do my best to share my experiences in learning python and hope that this becomes some sort of guide to help you become a Python programmer. In today’s post, I explain how to write your first Python program. If you … 

 

Python 101: Getting it

This post is part 1 of Get started with Python programming series, in which I do my best to share my experiences in learning python and hope that this becomes some sort of guide to help you become a Python programmer. In today’s post, I explain how to get and setup Python. Getting Started with … 

 

DOCTEST : An easy testing tool

According to author Daniel Arbuckle, Doctest is the easiest and fastest way to write tests for your python software.Doctest is a program that comes bundled with python that allows you to write down what you expect from your code in a way that’s easy to understand. Doctests are written in plain text usually in code … 

 

A text Based Game that you can’t win

–You really can’t win this one, and no, it’s not a bug, its a feature. Yes I just had to say that. Here’s a linkĀ  to a game I’ve been working on. This game is command line based and presents you with a series of menus where you choose an outcome. There’s really no point …