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.
./102_intermediate.py file.txt 4
Total words with unique characters under or equal to 4 is 10442
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.