Category Archives: Python

Python topics

Daily Programmer Task 102 Intermediate

Daily programmer challenge #102 was to create a program that counted the number of unique characters in a list of words and output the total number that were below a number you give it. My version does that and works like a command line program by passing system arguments. The file it takes should be a text file that can have multiple words on a line.


./ file.txt 4


Total words with unique characters under or equal to 4 is 10442

Daily Programmer Challenge 102

Well I came across this subreddit, Daily Programmer. The challenge was neat, create a program in whatever language you want that outputs roll results from the input like 1d6+1. I knew I could do it and after about a half hour of toying around I have it working slightly differently in python then the other python ways that are in the thread.

My version, keeps you in a loop until you give the program a blank line. Accepts input with spaces between the numbers, so you could input 1 d 6 + 1 if you wanted. Other versions are in the subreddit thread.

I’ll probably do some of these challenges depending on what looks fun. I hope to do at least one a week though. Plus I learned something new which is what I really cared about. Python ternary style operators.

 a = x if a > x else y

It will set a to x if x is greater than a. Otherwise a becomes y.

Comic list generator

Well I have this compulsion to make lists of things that I am collecting in games or not so when I found out about Ms Marvel I wanted to get all of the that I could. I’ve worked out a simple script that will get them and put them into a CSV file. Usage is simple, put in the title with no spaces when it asks, enter in the url of the list of comics, then how many pages it covers. Only works on marvel pages like Ms Marvel 2006. I’ll eventually expand it a bit more because I know I’ll want to collect other series. Maybe it will be helpful for someone else.

Just an update it will work for DC comics now too like Teen Titans 2011.

If you want a copy of it you can download it here.