Community Data Science Course (Spring 2023)/Week 2 coding challenges: Difference between revisions

From CommunityData
No edit summary
 
(5 intermediate revisions by one other user not shown)
Line 3: Line 3:
Imagine you are filling out a crossword and need a word that fits the pattern <code>E*G****R</code>. 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?
Imagine you are filling out a crossword and need a word that fits the pattern <code>E*G****R</code>. 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?


Python is a great tool for answering many of these kinds of questions! This project involves using our first "real" dataset: a list of every  
Python is a great tool for answering many of these kinds of questions! This project involves using our first "real" dataset: a list of every word in the English language from a scrabble dictionary.


==#0 Setup==
==#0 Setup==
Line 9: Line 9:
* Download the following file that contains the project for the week: https://github.com/CommunityDataScienceCollective/wordplay-cdsw/archive/refs/heads/master.zip
* Download the following file that contains the project for the week: 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.
* Open the file <code>wordplay_worked_examples.ipynb</code> as a Jupyter notebook and run the first cell to make sure that it works.
* Open the file <code>wordplay_examples.ipynb</code> as a Jupyter notebook and run the first cell to make sure that it works.


== #1 Play with pop ==
== #1 Alls well that ends well ==
 
There is a function in Python called <code>pop()</code>. Play around with it in your notebook and try to figure out what it does. When you're one, look it up online and try to confirm your suspicion. Where you right?
 
== #2 Alls well that ends well ==


# Find and print the words that end in "well" and be ready to tell me how many there are.
# Find and print the words that end in "well" and be ready to tell me how many there are.
Line 21: Line 17:
# How about "gry"?
# How about "gry"?


== #3 Counting vowels  ==
== #2 Counting vowels  ==


# How many words start with each vowel? Which is the common vowel to find at the beginning of a word?
# How many words start with each vowel? Which is the most common vowel to find at the beginning of a word?
# Which is the most common vowel to find at the end of a word?
# Which is the most common vowel to find at the end of a word?
# Find and print the words that have all 5 vowels in alphabetical order.
# Find and print all the words that have all 5 vowels in alphabetical order.


== #4 Disemvoweled ==
== #3 Disemvoweled ==


# Find and print the longest word that has no vowels.
# Find and print the longest word that has no vowels.


== #5 All that ells me ==
== #4 A cure for many ells ==


# Find an print the words that contain 4 or more 'l's.
# Find and print the words that contain 4 or more 'l's.
# How many are there?
# How many are there?


== #6 So long ==
== #5 So long ==


# What is the longest word in the word list you've been given? How long is it?
# What is the longest word in the word list you've been given? How long is it?
# Are there more than one word of that length? If so,  tell me how many are that exactly that long.
# Are there more than one word of that length? If so,  tell me how many are that exactly that long.


== #7 Palindromes ==
== #6 Palindromes ==


# Print out a list of every [[:wiki:palindrome|palindrome]] (a word that is the same reversed) that's over 6 letters in length.
# Print out a list of every [[:wiki:palindrome|palindrome]] (a word that is the same reversed) that's over 6 letters in length.
# How many are there?
# How many are there?


== #8 Something fun ==
== #7 Something fun ==


# Pick one other thing off this list of other interesting properties of English words in pages like [http://www.sporcle.com/games/imabanana/uncommonwords this quiz about English words with unusual properties] and write a Python problem to solve it.
# Pick one other thing off this list of other interesting properties of English words in pages like [http://www.sporcle.com/games/imabanana/uncommonwords this quiz about English words with unusual properties] and write a Python problem to solve it.


[[Category:CDSW]]
[[Category:CDSW]]

Latest revision as of 03:54, 7 April 2023

Crossword.png

Imagine 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?

Python is a great tool for answering many of these kinds of questions! This project involves using our first "real" dataset: a list of every word in the English language from a scrabble dictionary.

#0 Setup[edit]

#1 Alls well that ends well[edit]

  1. Find and print the words that end in "well" and be ready to tell me how many there are.
  2. How about "mt"?
  3. How about "gry"?

#2 Counting vowels[edit]

  1. How many words start with each vowel? Which is the most common vowel to find at the beginning of a word?
  2. Which is the most common vowel to find at the end of a word?
  3. Find and print all the words that have all 5 vowels in alphabetical order.

#3 Disemvoweled[edit]

  1. Find and print the longest word that has no vowels.

#4 A cure for many ells[edit]

  1. Find and print the words that contain 4 or more 'l's.
  2. How many are there?

#5 So long[edit]

  1. What is the longest word in the word list you've been given? How long is it?
  2. Are there more than one word of that length? If so, tell me how many are that exactly that long.

#6 Palindromes[edit]

  1. Print out a list of every palindrome (a word that is the same reversed) that's over 6 letters in length.
  2. How many are there?

#7 Something fun[edit]

  1. Pick one other thing off this list of other interesting properties of English words in pages like this quiz about English words with unusual properties and write a Python problem to solve it.