Mad Libs
Mix.install([
{:jason, "~> 1.4"},
{:kino, "~> 0.9", override: true},
{:youtube, github: "brooklinjazz/youtube"},
{:hidden_cell, github: "brooklinjazz/hidden_cell"}
])
Navigation
Home Report An Issue Habit TrackerGuessing GamesMadlibs
You’re going to create some mad lib games. A madlib is a game where the player can enter in a word or sentence to fill in the blanks.
String Concatenation Madlib
In the Elixir cell below, bind each blank word to a variable. Then use string concatenation to combine these values into a single string madlib.
> A programmer is a that turns into __.
Example solution
blank1 = "person"
blank2 = "coffee"
blank3 = "code"
"A programmer is a " <> blank1 <> " that turns " <> blank2 <> " into " <> blank3
Enter your solution below.
a = "dog"
b = "cats"
c = "fish"
"A programmer is a " <> a <> " that turns " <> b <> " into " <> c <> "."
String Interpolation Madlib
In the Elixir cell below, bind each blank word to a variable. Then use string interpolation to combine these values into a single string madlib.
> and combined makes __.
Example solution
blank1 = "foo"
blank2 = "bar"
blank3 = "foobar"
"#{blank1} and #{blank2} combined makes #{blank3}."
Enter your solution below.
a = "Fish"
b = "Cows"
c = "Surf 'n Turf'"
a <> " and " <> b <> " combined makes " <> c <> "."
Commit Your Progress
DockYard Academy now recommends you use the latest Release rather than forking or cloning our repository.
Run git status
to ensure there are no undesirable changes.
Then run the following in your command line from the curriculum
folder to commit your progress.
$ git add .
$ git commit -m "finish Mad Libs exercise"
$ git push
We’re proud to offer our open-source curriculum free of charge for anyone to learn from at their own pace.
We also offer a paid course where you can learn from an instructor alongside a cohort of your peers. We will accept applications for the June-August 2023 cohort soon.