THE NINE WINS AXIOM AWARDS

PHIL SIMON

Award-winning author, dynamic keynote speaker, trusted advisor, & workplace tech expert 

Geeking Out Over Scrabble in Python

Writing a little script to calculate the streak needed to hit a user-defined winning percentage.
Mar | 26 | 2020

 

Mar | 26 | 2020
}
One of the core tenets of my teaching philosophy is desirable difficulty. TLDR: Assignments and classes should be hard. By overcoming challenges in higher education, students prepare themselves for the real world. If this concept sounds familiar to you, perhaps it’s because Malcom Gladwell popularized it in David and Goliath: Underdogs, Misfits, and the Art of Battling Giants.

To be sure, many of my students aren’t fans of the concept—especially when I reinforce it with my syllabus’ no-hand-holding policy. I hope, though, that they’ll reflect in a few years on it and appreciate the method to my madness.

Of course, it would be hypocritical of me to ignore desireable difficulty when I face an obstacle my own. That’s exactly what happened yesterday when I was noodling with Python.

Why write scripts for fun? First, I’m not going out too much these days. Second, my editor is putting the final touches on Slack For Dummies. Finally, my courses this semester don’t cover the powerful, general-use programming language. If you don’t sharpen your axe from time to time, though, it will lose its sharpness.

If you don’t sharpen your axe from time to time, it will become dull.

Brass tacks: Last night was a perfect opportunity for some sharpening.

By way of background, I’m a big Scrabble fan.1 I wanted write a script that would calculate the number of consecutive games that I’d need to win to reach a goal. For instance, if I had won 50 out of 100 games, then how many games would I need to win in a row to hit 60 percent?

The math isn’t hard. Yes, it’s just algebra and you only need to solve for x. In the prior example, it’s 25.

I was curious about my options for solving this equation in Python. I imported SymPy, a library for symbolic mathematics but I struggled trying to get it to do what I wanted. I sent a message to a friend of mine who has forgotten more about Python than I’ll ever know. It turns out that he hadn’t used SymPy much.

I went to sleep determined to figure it out. I’m nothing if not stubborn. A fresh set of eyes and a new perspective led to this:

No, it’s not the most elegant code and I’m sure that there many other ways to do the same thing. Still, it works.

Simon Says: Professors should practice what they preach.

Little victories can do wonders for your confidence, especially in trying times. Beyond that, why not set an example for your students?

Footnotes

  1. At least the current version. Scrabble® GO sucks.

Go Deeper

Receive my musings, news, and rants in your inbox as soon as they publish.

 

 Blog E Higher Education E Geeking Out Over Scrabble in Python

0 Comments

Comments close 180 days after post publishes.

 

Blog E Higher Education E Geeking Out Over Scrabble in Python

Next & Previous Posts

0 Comments