# Comparison Between the Scratch and Python Code

In this step, I am going to look at a fairly simple game using string operations, and compare the Scratch and Python code. You will create the game too!

This is a game that asks the players to provide various words, such as nouns, verbs, and adjectives. These words are then entered into a story that has missing nouns, verbs, and adjectives — often with humorous results.

I’ll begin by writing a simple story, and will then look for words to replace. This is a slightly edited section from the Simple English Wikipedia entry on ice cream:

Ice cream is a frozen dessert made from cream, with added flavours and sweeteners. This mixture is quickly frozen while it is stirred, so that large ice crystals do not form. Some ice cream is made with carrageenan, extracted from seaweed, so that it is not sticky. There are many different flavours of ice cream, such as chocolate and vanilla. Ice cream often has things added to it for flavour, like chocolate chips, nuts, or fruit.
You can use this passage for your game, or come up with your own version. Now that I have the basic text, I can replace some of the words, such as nouns and verbs. I will ask the user to add new nouns and verbs which be entered in the respective places below:
Ice cream is a frozen dessert made from plural noun , with added flavours and sweeteners. This mixture is quickly frozen while it is verb ending in ed , so that large plural noun do not form. Some ice cream is made with noun , extracted from seaweed, so that it is not sticky. There are many different flavours of ice cream, such as food and food . Ice cream often has things added to it for flavour, like noun, noun , or noun.

Now I want you to think about how you could start to create the game. The solution is fairly simple:

1. Ask for the user to input some words, such as plural nouns, verbs, and foods
2. Assign these inputs to variables
3. Insert these variable values into the strings to complete the paragraph

You are going to look at the three programming constructs used in the game in Scratch and Python, to compare how these are implemented in both a block-based and a text-based programming language.

1. Asking for input from the user and assigning variables to that input
noun_1 = input('Give me a plural noun')


1. Outputting strings

print('Ice cream is a frozen dessert')
print (noun_1)


1. Concatenating strings

print("Ice cream is..." + noun_1 + ", with added flavours...")


To make the game, you can begin by asking the user for lots of words, and finish by inserting them into some strings that will be printed.

Here is the code for a partially completed Python program for the game.

noun_1 = input("Give me a plural noun ")
verb = input("Give me a verb ending in ed ")
noun_2 = input("Give me another plural noun ")
noun_3 = input("Give me a noun ")
### Add more code here to complete the game

print("Ice cream is a frozen dessert made from " + noun_1 + ", with added flavours and sweeteners")
print("This mixture is quickly frozen while it is " + verb + ", so that large " + noun_2 + " do not form.")
print("Some ice cream is made with " + noun_3 + " extracted from seaweed, so that it is not " + adjective)
### Add more code here to complete the game


### Challenge

1. Create a new Python program

1. Copy in the code from above

1. Add the following variables and complete the game:
• food_1

• food_2

• noun_4

• noun_5

• noun_6

• Any requests for help that you have

Remember to use three tilde characters (~~~) at the start and end of your code, as in this example comment text:

I created this program.

~~~
print("This is my code")
~~~