Perez: the great adventure

Course content

This course is designed to challenge students who have completed basic programming knowledge in order to further develop those skills and learn how to apply their knowledge to real-life problems. A range of STEM problems have been incoroporated into this course, including mathematics, physics and chemistry. It is recommended that students have completed "Python for beginners" course, as majority of the problems based on material taught in the beginners course.

This practice based learning material will allow school children to further develop their Python programming skills, using situated cognition teaching strategy. Such teaching strategy is heavily based upon the idea of learning in practice, rather than theory. The key principles of situated cognition that will need to be considered throughout this project include: Affordances/Effectivities, Perception (Variance/Invariance), Memory, Knowing, Learning, Language, Legitimate peripheral participation, Representation, Symbols, and Schema, Goals, Intention and Attention, Transfer and Embodied cognition.

In order to make the learning more engaging we have decided to focus on creating a character with a background story. As our aim is to show how programming is applied to real life problems, the idea is to have character involved in various scenarios that require some problem to be solved using programming skills; however rather than providing step by step instructions and strict mark schemes for those tasks, we have decided that it will be left open, enabling students to come up with unique solutions based on problem criteria. The character, story and scenarios (problems) will be introduced in form of videos.

Getting started (Resources and setup)

To be able to write Python code there are certain things that are required. It is imperative that you download the Python software from this site. Please download version 2.7 (as this is more stable) and appropriate for this course. Do not download Python 3. Download and install the appropriate version for your computer.

In order to view videos you will need a stable internet connection and open access to youtube.

With the download, there is a program called Python IDLE includes which acts like a text editor for Python code. Open Python IDLE and this will open up something called “Python Shell” which is where the output of your code will be displayed. You could type code into the shell and run it, but this is not recommended for longer code. Press New File and this will create a new empty Python file where you can write your Python code. Once you have written Python code, click on Run -> Run Module and this remind you to save the file and then you must save it in a location. The file will then execute and your code will run. You must save your Python file every time you want to run it.

Lesson 1

Main task

Perez is a python in Mexico who owns a restaurant and wants to go a vacation. He decides that the tips he receives from selling one of his most popular meals in the restaurant will contribute to his fund for his vacation.

Perez is not very good at math and he wants your help in choosing the meal that he should collect the tips from in order to save up at least £3000 as fast as possible. He gets a 15% tip for each meal sold. To motivate Perez to work hard, find out the least number of meals he has to sell in order to reach his goal.

Use this template to help you.

Give answers start of lesson 2.

Lesson 2

Main task

Perez is on his way to China, and wants to be able to speak to the locals. Help Perez by writing a dictionary that converts phrases from English to Chinese. Your program should allow Perez to enter an English phrase into the program, and then output the Chinese translation. Here is a list of English phrases and their corresponding Chinese phrases. This time, the lists won't be created for you. You'll have to create 2 lists yourself: One for the English phrases and one for the Chinese equivalent.

Entering the phrase in English should print out the corresponding phrase in Chinese.

After you have finished creating main program, find the way to add more phrases to the dictionary. Add phrase "Can I play football with you?" to the dictionary.

Show the dictionary at the start of lesson 3.

Use this template to help you.

Lesson 3

Main task

Perez has successfully managed to ask the locals for a game of football. After a good kick about, time is almost up and it is up to Perez to score a goal and win the game. All Perez has to do is kick the ball so that it reaches the goalpost, evades the goalkeeper, and scores the winning goal. Perez is very nervous now; he never knows the correct amount of force to put into his kick. Too little, and the ball will never even reach the goalkeeper. Too much and the ball will fly right the way over the goalpost. To top it off, the ball could reach Perez at different speeds depending on who's passed it to Perez and how hard they've kicked the ball. If the ball reaches him at a slow speed, then more force is required in Perez's kick, and vice versa.

Help Perez by writing a program in Python that tells him the maximum and minimum force what force he should kick the ball with, depending on the speed at which the ball reaches him. Your program needs to scan a list to find the highest and lowest speeds at which the ball reaches Perez, and input those two values into a mathematical formula in order to output the maximum and minimum force Perez needs to perfect his kick. To do this, you need to apply Newton's second law of motion. Force = Mass * Acceleration

Hint: Force = Mass * ((Final Velocity - Initial Velocity) / Time)

A wise old man tells Perez that the mass of the ball 0.45 kilograms, and that the ideal speed of the kick is 30m/s. The ball will be in contact with Perez's tail for 0.05 seconds.

Use this template to help you.

Give answer at the start of lesson 4.

Lesson 4

Main task

As Perez is playing football, he hurts and damages his fang so he decides to go to the dentist. Perez sits down on the dentist chair and waits for the dentist to work his magic. However, the one of the bolts is missing from the dentist's chair, causing the it to tip backwards and forwards.

Perez thinks he can keep the chair balanced if he replaces the bolt, however there is a huge range of tools to choose from. The force of exactly 25Nm must be applied to the bolt to be able to set the it correct. Write a program which qould help Perez choose an appropriate tool based on lists provided in the template.

Hint: Moment = Force * Pivot Distance

Use this template to help you.

Give answer at the start of lesson 5.

Lesson 5

Main task

The dentist is amazed by what Python can do and realises how powerful he can be if he has such skills. He decides to kidnap Perez and keep him to make use Perez's incredible powers of programming. Thus, while Perez lies on the dentist chair, the dentist knocks Perez out, kidnaps him and brings him to a dark room.

Perez wakes up much later with a terrible headache that compromises his super abilities as a python. However, he soon realises that he is trapped inside there and he is determined to break out of the room to gain back his freedom. The door is locked and the lock is very secure: it requires a key phrase to enter. Perez has no idea what the key phrase is, but it seems like a previous prisoner has sketched a clue it into the wall.

"A+1 = B, C+1=D and MPWFQZIPO"

Perez thinks that the key phrase to unlock the door is MPWFQZIPO replaced with the letter in the alphabet before. Can you write a program that would help Perez to decode the password?

Use this template to help you.

Give answer at the start of lesson 6.

Lesson 6

Main task

Perez finds his way out but walks straight into the evil dentist. The dentist is a master of PyFu and there is no way Perez can beat him. He notices a bunch of chemicals on the side and decides to mix them to create a smoke flare.

He remembers from his good old days in chemistry how to make smoke. Using 3 units of Potassium Nitrate, 2 units of sugar and 1 unit of baking soda, 6 units of smoke will be made and Perez knows that with this magical formula he will need 48 units of smoke to create a thick screen of smoke that will help him to escape.

However, there is a risk involved. Making too much smoke might suffocate poor Perez, but too little smoke won't help him escape at all. He also has to use the correct measurements to ensure the correct ratio of these three things mixed together. Help Perez to create a ratio checker so that the exact units are used and Perez will be able to escape successfully!

ASSESSMENT & MARKING GUIDELINE

Skill assessment

This is an assessment criteria that can be used to assess your skills for this module.

Level

Description

1

Be able to use comments to explain your code

Use simple math operators like ( +/-)

The code compiles without errors

2

Be able to apply operations on different variables

Know the difference between string and numeric variable types

Convert back and forth between string and numeric types

3

Use simple functions

Use basic if statements

Use basic while loop

4

Use I/O

Save information into a list

Use for loop to iterate over the list

5

Use functions within functions

Use function return types as testing condition

6

Use combination of loops and if statements within each other

Reuse function code but with different parameters

Sensible function names and code layout

7

Use a range of statements and programming techniques to create a functional program

8

Use a range of statements and programming techniques to solve compound problems

Writing efficient functional programs

Coursework assessment

Click here to view marking scheme