Powered by AppSignal & Oban Pro
Would you like to see your link here? Contact us

Animal Generator

deprecated_animal_generator.livemd

Animal Generator

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 AnagramBook Search

Animal Generator

Often we need to create large amounts of fake data in order to test our applications. To simulate this experience, you’re going to build data for an animal simulator game.

Each animal will be represented with a map. Each map should have the keys name, animal_type, and age.

Use the following names, species, and age ranges to generate your animal data. You may alter this to suite your own creative preferences!

names = ["Clifford", "Zoboomafoo", "Leonardo"]
animal_types = ["dog", "lemur", "turtle"]
ages = 1..14

Your list of animals should include every permutation of names, species, and ages. There are 126 permutations in the data examples above.

Hint

Consider using names, animal_types, and ages as generators for a comprehension.

Example Solution

names = ["Clifford", "Zoboomafoo", "Leonardo"]
animal_types = ["dog", "lemur", "turtle"]
ages = 1..14

for name <- names, animal_type <- animal_types, age <- ages do
  %{name: name, animal_type: animal_type, age: age}
end 

Enter your solution below.

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 Animal Generator 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.

Navigation

Home Report An Issue AnagramBook Search