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.