# Extension Challenge

**Challenge 1: Using lists in Scratch to create random stories.**

A list is a type of variable that lets you store more than one piece of information inside. In this challenge, you can create a list of nouns, a list of verbs, a list of adjectives, and any other lists and then have your code pick one at random to complete your story.

Tips for doing this:

·         In <mark style="color:orange;">**Variables**</mark> you can make a list

·         You can ask for a word to add to the list by using the ask block in <mark style="color:blue;">**Sensing**</mark> and adding <mark style="color:blue;">**answer**</mark> to your list<br>

<div align="left"><img src="https://263142761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmwVbnBfryEwHBRnI3as7%2Fuploads%2FSPPNcHVMJbGgqxtysayi%2FVariable%20Stories%20Extension%201.png?alt=media&#x26;token=dd3e8f00-9d04-4792-a819-03498cf9751c" alt=""></div>

&#x20;o When you want to use a random word in your story there are three things you must do:

o   Create a variable to use in the story

o   Use a random number block from <mark style="color:green;">**Operators**</mark> to get a word from a random place in your list\
&#x20;

<div align="left"><img src="https://263142761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmwVbnBfryEwHBRnI3as7%2Fuploads%2FZ3KARuQuNGHrVc0gOZ7D%2FVariable%20Stories%20Extension%202.png?alt=media&#x26;token=26143269-158e-424e-965e-ecf927352300" alt=""></div>

o   Then set your story variable to be this random word

·         Fill your lists when you click the green flag and tell your story when you hit space

·         Can you hide your lists after you fill them?

**Challenge 2: Code a mad lib using Python coding language.**

You can write and execute python code using this free web-based editor, clicking <>**Start Coding**, and selecting python:

### <https://repl.it/>

Tips for doing this:

·  Use [**input**](https://www.w3schools.com/python/ref_func_input.asp) to set the value of all of your variables – *watch what type of information you’re gathering: string, integer, etc. This may affect how the story is shown*

·  Use the [**print**](https://www.w3schools.com/python/ref_func_print.asp) command to show your story once you’ve gathered all your information

·  Can you use arrays to create random stories as above?

Python Reference Documentation: <https://www.w3schools.com/python/python_reference.asp>

You can watch a basic tutorial here: <https://www.mikedane.com/programming-languages/python/building-a-mad-libs-game/>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://science-world.gitbook.io/variable-stories-with-scract/activities/extension-challenge.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
