Welcome to

## Argh The Data Pirate and the quest for the lost Data Pearl!

## About the book

Argh the Data Pirate is the first book in a children's book series designed to introduce kids to data science and coding in a programming language called **R** - used for statistical analysis.

The book is easy to understand, requires no prior knowledge of data science, and is - of course - heaps of fun. Kids learn via using LIVE code editors, which you can find on this page (scroll down). There's nothing more exciting for kids than the moment when they run their first lines of code!

With skills learnt from the Argh the Data Pirate series, kids will be able to read and understand sets of data, and perform powerful analysis on them to discover amazing facts and insights. The skills learn't in data science are exceptionally good for developing children's ability to think mathematically, problem solve, and to think analytically.

In a world driven by technology, data science is in increasingly huge demand. In 2016, data science positions have been rated amongst the highest sought after, and highest paid jobs in the tech industry.

## To get a copy of the book, choose from either of the options below.

NOTE: When you purchase the e-book, you will automatically & instantly receive a download link to the e-book!

## I would like to

# OR

# CODING EXERCISES

Below you will find the coding exercises for Argh the Data Pirate - and the quest for the lost data pearl.

See the book for instructions! :) Have fun!

NOTE: The Code boxes are down for the moment - in the meantime you run them here: https://rdrr.io/snippets/

thanks for your patience!

```
# This will get executed each time the exercise gets initialized
```

```
# First, lets make some chips!
chips <-
# Next, lets make some seagulls!
seagulls <-
#Now use code to divide the number chips by the number of seagulls so each seagul gets the same number of chips!
chips / seagulls
```

```
# First, lets make some chips!
chips <- 20
# Next, lets make some seagulls!
seagulls <- 5
#Now use code to divide the number chips by the number of seagulls so each seagul gets the same number of chips!
chips / seagulls
```

```
test_object("chips")
test_object("seagulls")
success_msg("Great job!")
```

## EXERCISE 2: Rgh's Belt (PAGE 13)

```
# This will get executed each time the exercise gets initialized
```

```
# Use code to put the items back into Rgh's Belt!
belt <- c(" "," "," ")
# Now print belt below
print(belt)
```

```
# Use code to put the items back into Rghs Belt!
belt <- c("cup","hat","map")
# Now print belt below
print(belt)
```

```
test_object("belt")
success_msg("Great job!")
```

## EXERCISE 3: Find the Shortest Path! (PAGE 15)

```
# This will get executed each time the exercise gets initialized
```

```
# Each path on the map has a different number of lines. Count how many dashed lines each path has and put them in the word paths. Example: 1,2,3.
paths <- c(,,)
# Next we will give each number a name so that our code knows which number belongs to which path.
names(paths) <- c(" "," "," ")
# Now lets see what your collecton of paths looks like.
print(paths)
# Great! But which is the shortest. let's use code to sort the paths from shortest to longest, so we can find the shortest one easily!
sort(paths)
```

```
# Each path on the map has a different number of lines. Count how many dashed lines each path has and put them in the word paths. Example: 1,2,3.
paths <- c(7,5,6)
# Next we will give each number a name so that our code knows which number belongs to which path.
names(paths) <- c("lake","cave","volcano")
# Now lets see what your collecton of paths looks like.
print(paths)
# Great! But which is the shortest. let's use code to sort the paths from shortest to longest, so we can find the shortest one easily!
sort(paths)
```

```
test_object("paths")
test_function("names")
success_msg("Great job!")
```

## EXERCISE 4: Count the letters of Bossy Crab's Name! (PAGE 17)

```
# This will get executed each time the exercise gets initialized
```

```
# Count the number of letters in Bossy Crab's name!
nchar(" ")
```

```
# Count the number of letters in Bossy Crab's name!
nchar("TallyHappyFlappySnappyCrab")
```

```
test_function("nchar")
success_msg("Great job!")
```

## EXERCISE 5: Count the Treasures! (PAGE 19)

```
# This will get executed each time the exercise gets initialized
```

```
# Count how many coins and jewels are in the chests below. Then add them to your code!
chest1 <- c( , , )
chest2 <- c( , , )
# Now we're going to use code to add all the jewels together, and find out which chest has more!
sum(chest1) > sum(chest2)
```

```
# Count how many coins and jewels are in the chests below. Then add them to your code!
chest1 <- c(17,1,3)
chest2 <- c(19,3,2)
# Now we're going to use code to add all the jewels together, and find out which chest has more!
sum(chest1) > sum(chest2)
```

```
test_object("chest1")
test_object("chest2")
success_msg("Great job!")
```

## EXERCISE 6: Climb to the Pearl! (PAGE 21)

```
# This will get executed each time the exercise gets initialized
```

```
# Count up the number of good steps and wobbly steps for each path, then add them to your code below!
brown <- c( , )
yellow <- c( , )
red <- c( , )
# Now put them all together in a table called allpaths to make them easy to read!
allpaths <- cbind( , , )
# next add labels for your steps in the table so you know which one is which.
rownames(allpaths) <- c(" "," ")
# Fantastic! Now print out your table to see what it looks like!
allpaths
```

```
# Count up the number of good steps and wobbly steps for each path, then add them to your code below!
brown <- c(3,2)
yellow <- c(2,3)
red <- c(4,1)
# Now put them all together in a table called allpaths to make them easy to read!
allpaths <- cbind(brown, yellow, red)
# next add labels for your steps in the table so you know which one is which.
rownames(allpaths) <- c("good","wobbly")
# Fantastic! Now print out your table to see what it looks like!
allpaths
```

```
test_object("brown")
test_object("yellow")
test_object("red")
success_msg("Great job!")
```

## EXERCISE 7: Summon 100 Sea turtles! (PAGE 23)

```
# This will get executed each time the exercise gets initialized
```

```
# Use code to summon 100 sea turtles to help fix Rgh's ship!
seaturtles <- paste(" ",1: )
# Now type seaturtles
seaturtles
```

```
# Use code to summon 100 sea turtles to help fix Rgh's ship!
seaturtles <- paste("seaturtle",1:100)
# Now type seaturtles
seaturtles
```

```
test_object("seaturtles")
success_msg("Great job!")
```

# WELL DONE!

for finishing all the coding exercises! I've create an empty code editor below so you can practice using all the code you have learned so far! Happy coding :)

```
# This will get executed each time the exercise gets initialized
```

```
```

```
```

```
```