7
votes
3answers
242 views

Simple MPG calculator in Python

I am a self taught coder taking a Programming Fundamentals class to work towards a degree. It's based on Python, which I'm not as familiar with as other languages. I added error handling like I would ...
6
votes
2answers
325 views

Number-to-word converter

My code works, but the aesthetic of the code seems to need some real work. The logic is simple enough: create three lists of words that will be used throughout the conversion, and create three ...
5
votes
1answer
3k views

Conversion from/to roman numbers

I wrote as an exercise in Test-Driven Development a piece of Python code that contains two functions: roman2dec(roman), that converts a roman number (string) into ...
5
votes
3answers
325 views

Organization of measurements converter

I am pretty new to Python but I'm learning from classes. I am working on a project for class and this is my code. Anyone got a better idea of a way to organize the code or put it differently so there ...
4
votes
3answers
372 views
4
votes
2answers
859 views

Simple age converter

I want you to pick my code apart and give me some feedback on how I could make it better or more simple. In my opinion this is the best code I have written, being that I'm new to programming. The ...
4
votes
2answers
154 views
3
votes
1answer
53 views

Converting float from arbitrary base to arbitrary base

I needed to write a small program to convert floats from any base to any other base. The thing is, it got big. I know there are other ways to implement the conversions (such as doing subtractions ...
2
votes
3answers
137 views

Python Barcode Generator

I was asked to provide some example code for a job interview and didn't have anything to offer, so I wrote the following function. A barcode generator may seem a bit basic, but there's some logic ...
2
votes
3answers
127 views

Convert carry-add loop to a map or reduce to one-liner

I want to perform standard additive carry on a vector. The base is a power of 2, so we can swap modulus for bitwise AND. ...
1
vote
4answers
319 views

Binary/decimal/hex converter using Tkinter

I debated long and hard before posting this question, and I did a lot of experimenting. I just can't seem to work out an 'elegant', concise way to get done what I want done in the manner I want it ...
1
vote
1answer
110 views

Python converter: number-to-English

So I wrote this function to convert a given number to its interpretation in the English language as part of the Project Euler exercises. It works fine, but I sense that it's rather sloppy and ...
1
vote
0answers
9 views

Extra elements in Python list [migrated]

Using Cython, I am trying to convert a Python list to a Cython array, and vice versa. The Python list contains numbers from the range 0 - 255, so I specify the type of the array as an ...
0
votes
2answers
655 views

Command line tool for extracting, searching, and converting

I just completed my first real application (command line app). It's simple, but I had no prior knowledge of Python. Everything was hit and miss, with many Python books and help from those in this ...