Wordplay: Difference between revisions

From CommunityData
No edit summary
 
 
(9 intermediate revisions by 5 users not shown)
Line 3: Line 3:
You are filling out a crossword and need a word that fits the pattern E*G****R. What are your options? How many words have all 5 vowels in order? What's the only common English word that ends in 'mt'? What are the most possible points you can score with an English word in Scrabble?
You are filling out a crossword and need a word that fits the pattern E*G****R. What are your options? How many words have all 5 vowels in order? What's the only common English word that ends in 'mt'? What are the most possible points you can score with an English word in Scrabble?


Use Python to answer questions like this instantly while practicing manipulating data from a file and regular expressions.
Use Python to answer questions like this instantly while practicing manipulating data from a file and engaging in a range of string manipulation tasks


==Setup==
==Setup==


Download the file following file: http://mako.cc/teaching/2015/community_data_science/wordplay.zip
Download the following file: https://github.com/CommunityDataScienceCollective/wordplay-cdsw/archive/refs/heads/master.zip


Once you have downloaded the file, extract the contents of the file into a folder on your desktop.
Once you have downloaded the file, extract the contents of the file into a folder on your desktop.


==Handout==
Open the file <code>wordplay_worked_examples.ipynb</code> as a Jupyter notebook and run the first cell to make sure that it works.
<!-- ==Handout==


[[Wordplay handout]]: goals and cheat sheet.
[[Wordplay handout]]: goals and cheat sheet.
 
-->
==Goals==
==Goals==


* Have fun using Python to cheat at Scrabble and crosswords.
* Have fun using Python to cheat at Scrabble and crosswords.
* Practice using lists and manipulating strings.
* Practice using lists, <code>for</code> loops, and basical tools for manipulating and asking questions about strings.


==Ideas for exercises==
==Ideas for exercises==
Line 27: Line 28:
* Find an print the words that contain 4 or more 'l's.
* Find an print the words that contain 4 or more 'l's.
* Find and print the words that have all 5 vowels in alphabetical order.
* Find and print the words that have all 5 vowels in alphabetical order.
* Look for other interesting properties of English words in http://en.wikipedia.org/wiki/English_words_with_uncommon_properties and write code to find the words that have these properties.
* Look for other interesting properties of English words in pages like this quiz asking to find [http://www.sporcle.com/games/imabanana/uncommonwords English words with unusual properties]. How many can you solve with Python?
 
[[Category:CDSW]]

Latest revision as of 23:31, 3 April 2023

Crossword.png

You are filling out a crossword and need a word that fits the pattern E*G****R. What are your options? How many words have all 5 vowels in order? What's the only common English word that ends in 'mt'? What are the most possible points you can score with an English word in Scrabble?

Use Python to answer questions like this instantly while practicing manipulating data from a file and engaging in a range of string manipulation tasks

Setup[edit]

Download the following file: https://github.com/CommunityDataScienceCollective/wordplay-cdsw/archive/refs/heads/master.zip

Once you have downloaded the file, extract the contents of the file into a folder on your desktop.

Open the file wordplay_worked_examples.ipynb as a Jupyter notebook and run the first cell to make sure that it works.

Goals[edit]

  • Have fun using Python to cheat at Scrabble and crosswords.
  • Practice using lists, for loops, and basical tools for manipulating and asking questions about strings.

Ideas for exercises[edit]

  • Find and print the words that start with "ee".
  • Find and print the words that end in "mt". How about "gry"?
  • Find and print the longest word that has no vowels.
  • Find an print the words that contain 4 or more 'l's.
  • Find and print the words that have all 5 vowels in alphabetical order.
  • Look for other interesting properties of English words in pages like this quiz asking to find English words with unusual properties. How many can you solve with Python?