More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
post
page
Python IDE Dashboard

Endurance Shipwreck Search Expedition

The story of the Endurance shipwreck is one of the most remarkable survival tales in the history of exploration, highlighting the endurance and courage of Ernest Shackleton and his crew during their expedition in the early 20th century.

In 1914, Sir Ernest Shackleton, set out on the Imperial Trans-Antarctic Expedition, aiming to be the first to cross Antarctica from sea to sea via the South Pole. The Endurance, a sturdy, three-masted ship, left England in August 1914, just as World War I was beginning. After a long voyage through the icy seas, the ship reached the Weddell Sea in January 1915, but then disaster struck. The ship became trapped in pack ice in the Weddell Sea before reaching the continent. For ten months, the crew lived aboard the ice-bound ship until it was crushed and sank in October 1915.

Stranded on the ice, Shackleton and his men camped for months before taking lifeboats to Elephant Island. With no chance of rescue there, Shackleton and five others made an 800-mile journey in a small lifeboat to South Georgia Island, enduring treacherous seas. After reaching the West side of the Island, Shackleton had to cross the island’s mountains on foot to reach a whaling station. From there he organised a rescue mission. Miraculously, all 28 men were saved in August 1916, despite the extreme conditions they faced.

This survival story is a legendary example of leadership, resilience, and human endurance.

The Endurance22 Expedition

In 2022, a team of historians/marine archaeologists, scientists and engineers/technicians went back to the Weddell Sea on board a modern polar research ship, S.A. Agulhas II, with the aim to locate the exact position of the Endurance shipwreck. Their main technology to help them in this mission was a remote controlled Autonomous Underwater Vehicle/Submarine (AUV) used to scan the seabed more than 3,000m below sea level! With only a vague idea of where the shipwreck could be, they spent around 20 days scanning a fairly large area (approx. 125 nautical miles) of the Wedell Sea, only being able to scan a small surface per day.

You can find our more about this expedition on: https://endurance22.org/ and on this BBC article.

Your Challenge

Your challenge is going to help control the remote-controlled submarine (AUV: Autonomous Underwater Vehicle) by programming some instructions to help the AUV scan the ocean floor one step at a time and hopefully locate the Endurance shipwreck.

To do so, you will need to complete the code provided below. This code has already been started for you but is incomplete and does not cover the whole area to be searched today. You can run the code to see which sections of the seabed are already being covered. You will then be able to complete the code further to cover the whole search area.

Extra Challenge:

Once you have found the shipwreck, challenge yourself by tweaking your code to complete the following exploration paths:

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Storage Devices Python Challenge

The aim of this challenge is to create an “Odd One Out” quiz on storage devices using Python. But let’s first revisit the main technologies used by storage devices in a computer system.

We can categorise all the storage devices found within a computer system into three main categories based on the technology they rely on to store binary data:

Magnetic Storage Devices


Magnetic storage devices such as magnetic tapes, floppy disks, and hard disk drives (HDD). A hard drive contains a spinning disk coated with a magnetic material. A read/write head moves over the disk, changing the magnetic properties to store data. Magnetic tapes work similarly, but data is stored in a linear format on a magnetic ribbon (tape).

Optical Storage Devices


Optical storage devices such as CDs, DVDs and Blu-ray disks. With this technology, data is stored on the disc as tiny pits (dents) and lands (flat areas). A laser shines onto the surface, and the reflection is interpreted as binary data (1s and 0s) by a computer.

Flash/Solid State Storage Devices


Flash (a.k.a. solid state) storage devices such as USB Keys, SD cards, Micro-SD cards and Solid Sate Drives (SSD). Data is stored in memory chips that can be accessed almost instantly. These chips are made of semiconductors, which can retain data even when the device is powered off.

Python Quiz

For the purpose of this quiz we have stored the information regarding the different storage devices used in a computer system and their technology using three lists in Python:

optical = ["CD","DVD","Blu-ray"]
magnetic = ["Magnetic Tape","Floppy Disk","Hard Disk Drive (HDD)"]
flash = ["USB Key","SD Card","Micro-SD Card","Solid State Drive (SSD)"]

Using Python, you can easily merge two or more lists together using the + operator. e.g. to create a list containing all the storage devices:

allDevices = optical + magnetic + flash

Using the random library you can use two key functions shuffle() and choice():

import random

# Shuffle all the values of a list:
random.shuffle(allDevices)
print(allDevices)

# Pick a random value from a list:
randomDevice = random.choice(allDevices)
print(randomDevice)

Odd One Out Quiz

Your task is to create a 10-question quiz where for each question, the computer will randomly pick 2 storage devices of the same technology (e.g. two optical devices) and one random device from a different technology (e.g. either magnetic or flash). The computer will then display these three devices in a random order and ask the user to identify which of the three device is the odd one out.

For each correct answer the user should score 1 point. At the end of the 10 questions, the user should see their score out of 10.

Python Code

To complete this Python challenge you will need to complete the code below:

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Mountains Elevation Quiz

For this quiz we will use a data set of 10 of the most iconic mountains in the world.

Here is our data set, displayed as a table:

Name Location Elevation
Mount Everest Nepal / Tibet 8,849m
Mount K2 Pakistan / China 8,611m
Mount Aconcagua Argentina 6,959m
Mount McKinley Alaska, USA 6,190m
Mount Kilimanjaro Tanzania 5,895m
Mount Kenya Kenya 5,199m
Mount Blanc France 4,809m
Mount Fuji Japan 3,776m
Mount Etna Italy 3,369m
Ben Nevis Scotland, UK 1,345m

This data set will be stored in a Python program using a 2D array (list of lists) as follows:

mountains = [["Mount Everest","Nepal / Tibet",8849],
             ["Mount K2","Pakistan / China",8611],
             ["Mount Aconcagua","Argentina",6959],
             ["Mount McKinley","Alaska, USA",6190],
             ["Mount Kilimanjaro","Tanzania",5895],
             ["Mount Kenya","Kenya",5199],
             ["Mount Blanc","France",4809],
             ["Mount Fuji","Japan",3776],
             ["Mount Etna","Italy",3369],
             ["Ben Nevis","Scotland, UK",1345]]

Using the random library we can easily pick a random peak from this 2D array and display its name, location and elevation:

import random

number = random.randint(0,len(mountains)-1)
peak = mountains[number]
name = peak[0]
location = peak[1]
elevation = peak[2]
print(">>> Did you know?")
print(name + " is located in " + location + " and rises to " + str(elevation) + " meters." )

Your challenge

Your task is to create a quiz based on this data set. The rules of the quiz are as follows:

     A player starts with a health of 10,000 points and a score of 0.
     The computer randomly selects a peak from the data set and displays the name of the peak and its location.
     It then asks the player to estimate the elevation of the selected peak.
     The computer calculates the difference in meters between the answer given by the player and the real elevation of the peak and deducts this difference from the player’s health score.
     If the player’s health score is positive, then the player’s score goes up by 1 point.
     The quiz repeats itself for as long as the player’s health score remains positive.
     Once the player’s health score reaches zero or a negative value, a game over message is displayed alongside the player’s total score.

Python Code

You can complete your quiz by editing the Python code below:

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

World Buildings Quiz!

For this challenge you are going to create a quiz based on some of the most iconic buildings in the world. We have selected a collection of 20 buildings with their name, height in meters and location. This data is stored in a CSV file called iconic-buildings.csv.

We have started the code for this quiz by using the random library in Python to randomly select one building (one line) from the csv file. We are then extracting the information on this line to display a “did you know?” statement about this building.

You can test our Python code below:

Quiz #1 – Where in the world?

You task is to create a set of quizzes using this data file.

Your first quiz should randomly pick a building, display its name and height and ask the user if they can guess the country this building is from. The quiz should have 10 questions and at the end it should give the user a total score out of 10. Finally once a quiz is completed, the program should ask the user if they want to play again.

Quiz #2 – Which building is taller?

Your second quiz will randomly select and display the name and location of two buildings from the csv file and ask the player to decide which building is taller. The quiz should repeat this process for as long as the player is guessing correctly. The quiz should automatically stop when the user gives an incorrect answer. In this case, a total score (total number of correct guesses) should be displayed on the screen.

To finalise this project, you should add a menu screen giving the option for the user to decide which quiz they would like to complete.

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Storage Devices: The Technologies Behind Your Data

In this lesson we will investigate the three main technologies used by the different storage devices in a computer system:

  • Optical storage devices such as CD, DVDs and Blurays
  • Magnetic storage devices such as the Hard-Disk Drive (HDD), floppy disks and magnetic tapes
  • Solid-State storage devices such as SSD Drives, SD Cards and USB Keys.

Storage Devices: The Technologies Behind Your Data.

In today’s digital world, we use a ton of devices that rely on storage—your smartphone, laptop, gaming console, and even your smartwatch. But have you ever wondered where all your apps, photos, videos, and games are stored? That’s where storage devices come in, and understanding the technology behind them can help you make smart decisions about the tech you use.

Let’s dive into three major types of storage technologies: Optical, Magnetic, and Solid-State.


1. Optical Storage: CDs, DVDs, and Blu-rays

You’ve probably seen CDs, DVDs, or Blu-rays, especially for music, movies, or games. These round discs are examples of optical storage. This technology uses light to read and write data. Here’s how it works:

  • How It Works: Data is stored on the disc as tiny pits (dents) and lands (flat areas). A laser shines onto the surface, and the reflection is interpreted as binary data (1s and 0s) by a computer.
  • Examples: CD, DVD, Blu-ray.
  • Capacity: CDs can store up to 700 MB, DVDs up to 4.7 GB, and Blu-rays hold around 25 GB or more.
  • Durability: Optical discs are generally durable, but they can be easily scratched, which may corrupt the data.
  • Speed: Slower compared to other modern storage types.
  • Usage Today: Optical discs are becoming less common, especially since streaming and downloads have taken over. But they are still used for some software, movies, or games.

2. Magnetic Storage: Hard Drives and Tapes

If you’ve ever heard of hard drives (HDDs) or magnetic tapes, these use magnetic storage technology. This is one of the oldest storage methods and works by storing data as magnetic patterns on a spinning disk or a tape.

  • How It Works: A hard drive contains a spinning disk coated with a magnetic material. A read/write head moves over the disk, changing the magnetic properties to store data. Magnetic tapes work similarly, but data is stored in a linear format on a magnetic ribbon (tape).
  • Examples: Hard disk drives (HDDs), magnetic tapes.
  • Capacity: HDDs can range from a few hundred gigabytes (GB) to several terabytes (TB), while tapes can store massive amounts of data, often used in data centres.
  • Durability: Hard drives are fragile because they have moving parts. Dropping a laptop with an HDD could result in data loss.
  • Speed: Slower than solid-state storage, especially when accessing large amounts of data or booting up systems.
  • Usage Today: HDDs are still widely used in computers, gaming consoles, and servers because they offer large amounts of storage for a lower price. However, they’re slowly being replaced by faster and more reliable technologies like SSDs.

3. Solid-State Storage: SSDs and Flash Drives

Solid-state storage is the most modern and fastest-growing storage technology, used in solid-state drives (SSDs), SD cards and flash drives (USB sticks). It is different from magnetic or optical storage because it has no moving parts—everything is done electronically.

  • How It Works: Data is stored in memory chips that can be accessed almost instantly. These chips are made of semiconductors, which can retain data even when the device is powered off.
  • Examples: SSDs, USB flash drives, memory cards (like the ones used in phones and cameras).
  • Capacity: SSDs can store from a few hundred GBs to several TBs, and flash drives range from a few GBs to over 1 TB.
  • Durability: Because there are no moving parts, solid-state storage is much more durable than HDDs. They are shock-resistant, making them ideal for portable devices.
  • Speed: SSDs are way faster than HDDs. Your computer will start up and load apps much quicker with an SSD. The same goes for flash drives compared to CDs or DVDs.
  • Usage Today: SSDs have become the preferred storage for modern laptops, gaming consoles (like the PS5), and even smartphones. They offer high speed and reliability, though they are more expensive than traditional hard drives.

What’s the Best Choice for You?

  • Speed: If you want the fastest possible performance for gaming, editing, or general computer use, solid-state drives (SSDs) are the way to go.
  • Capacity on a Budget: For a lot of storage at a lower price, magnetic hard drives (HDDs) still offer a great option, especially for storing massive amounts of data like games, videos, and music libraries.
  • Backup & Media: While less common today, optical storage is a good, cheap way to store files you don’t use often or want to archive, such as photos, movies, or music.

The Future of Storage

As technology advances, solid-state storage is likely to continue improving in terms of speed, capacity, and cost. Meanwhile, cloud storage, where your data is saved on remote servers accessed via the internet, is becoming more popular. Still, having physical storage devices can be important for security, backup, or offline access.

Understanding how each storage technology works can help you make the best decision for your needs—whether it’s for gaming, school projects, or storing your favorite music and photos.
Now that you know the basics, you’re equipped to choose the best storage for your tech and data. Stay savvy!


Disclaimer
This article was generated with the help of ChatGPT, an artificial intelligence language model developed by OpenAI, and is provided for educational purposes.
Question 1[2 marks]

What is the technology used by storage devices like CDs, DVDs, and Blu-rays to store data and how does this technology work?




Question 2[2 marks]

What is the key difference between how magnetic storage and solid-state storage store data?




Question 3[2 marks]

List two advantages of solid-state drives (SSDs) compared to hard disk drives (HDDs).




Question 4[2 marks]

Why might optical storage be considered less common today, according to the article?




Question 5[2 marks]

In terms of durability, how do solid-state drives (SSDs) compare to hard disk drives (HDDs)?





Save / Share Answers as a link

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Smoothies Ingredients Data Set

For this programming challenge, we are going to practise reading and extracting data from a JSON file. We will be using a JSON file storing information about the ingredients and recipes for
20 different smoothies.

JavaScript Object Notation (JSON)

JavaScript Object Notation (JSON) is a lightweight, text-based format for storing and exchanging data that is human and machine-readable. It is a standard format that is often used to transfer/retrieve data from a server using an API. It is used in a wide range of web and mobile applications that rely on accessing/exchanging live data.

A JSON file is like a dictionary data structure. It is made up of two primary parts: keys and values. A key/value pair follows a specific syntax:

  • Key: Always a string enclosed in quotation marks
  • Value: Can be a string, number, Boolean expression, array/list, or object

Complex data structure can be created using JSON by combining {dictionaries} and [arrays/lists].

The smoothies data set: JSON vs. XML format

JSON Data SetXML Data Set
Here is an extract of the smoothies.json file showing the data for the first three smoothies.

Within this file, the main key is “smoothies”. Its value is an array of 20 different smoothies. Each smoothie is stored as a dictionary with 3 keys:

  • Name
  • Ingredients: a list of ingredients
  • Recipe
{
  "Smoothies": [
    {
      "Name": "Strawberry Banana",
      "Ingredients": ["Strawberries", "Banana", "Greek Yogurt", "Honey", "Almond Milk"],
      "Recipe": "Blend 1 cup of strawberries, 1 banana, ½ cup of Greek yogurt, 1 tablespoon of honey, and 1 cup of almond milk. Blend until smooth."
    },
    {
      "Name": "Green Detox",
      "Ingredients": ["Spinach", "Kale", "Green Apple", "Cucumber", "Lemon Juice", "Coconut Water"],
      "Recipe": "Combine 1 cup of spinach, 1 cup of kale, 1 green apple (cored and chopped), ½ cucumber, 1 tablespoon of lemon juice, and 1 cup of coconut water. Blend until smooth."
    },
    {
      "Name": "Mango Pineapple",
      "Ingredients": ["Mango", "Pineapple", "Orange Juice", "Coconut Milk", "Chia Seeds"],
      "Recipe": "Blend 1 cup of mango, 1 cup of pineapple, 1 cup of orange juice, ½ cup of coconut milk, and 1 tablespoon of chia seeds. Blend until smooth and creamy."
    }
  ]
}
An alternative approach to store data is to use an XML file. Here is the same data for the first three smoothies, stored as an XML file.

<Smoothies>
    <Smoothie>
        <Name>Strawberry Banana</Name>
        <Ingredients>
            <Ingredient>Strawberries</Ingredient>
            <Ingredient>Banana</Ingredient>
            <Ingredient>Greek Yogurt</Ingredient>
            <Ingredient>Honey</Ingredient>
            <Ingredient>Almond Milk</Ingredient>
        </Ingredients>
        <Recipe>Blend 1 cup of strawberries, 1 banana, ½ cup of Greek yogurt, 1 tablespoon of honey, and 1 cup of almond milk. Blend until smooth.</Recipe>
    </Smoothie>
    <Smoothie>
        <Name>Green Detox</Name>
        <Ingredients>
            <Ingredient>Spinach</Ingredient>
            <Ingredient>Kale</Ingredient>
            <Ingredient>Green Apple</Ingredient>
            <Ingredient>Cucumber</Ingredient>
            <Ingredient>Lemon Juice</Ingredient>
            <Ingredient>Coconut Water</Ingredient>
        </Ingredients>
        <Recipe>Combine 1 cup of spinach, 1 cup of kale, 1 green apple (cored and chopped), ½ cucumber, 1 tablespoon of lemon juice, and 1 cup of coconut water. Blend until smooth.</Recipe>
    </Smoothie>
    <Smoothie>
        <Name>Mango Pineapple</Name>
        <Ingredients>
            <Ingredient>Mango</Ingredient>
            <Ingredient>Pineapple</Ingredient>
            <Ingredient>Orange Juice</Ingredient>
            <Ingredient>Coconut Milk</Ingredient>
            <Ingredient>Chia Seeds</Ingredient>
        </Ingredients>
        <Recipe>Blend 1 cup of mango, 1 cup of pineapple, 1 cup of orange juice, ½ cup of coconut milk, and 1 tablespoon of chia seeds. Blend until smooth and creamy.</Recipe>
    </Smoothie>
</Smoothies>

Python Code

To be able to read and extract data from our JSON file using Python, we will use the json library. Here is an example of how to use Python code to load the JSON data from the smoothies.json file. We can then perform a basic linear search to retrieve all the smoothies with “Mango” listed in their list of ingredients.

import json
 
# load JSON data from file
file = open('smoothies.json','r')
data = json.load(file)
file.close()

# Perform a linear search using the JSON data
smoothies = data["Smoothies"]
for smoothie in smoothies:
   if "Mango" in smoothie["Ingredients"]:
      print(smoothie["Name"])
      print(smoothie["Recipe"])
      print("--------------------")

You can test and edit this code below:

Your Task:

Your task consists of creating a program that lets the end-user do the following:

     Enter a list of ingredients they would like to have in their smoothie. e.g. Papaya, Pineapple and Mango
     Enter a list of ingredients they do not want to have in their smoothie. e.g. Peanut Butter and Cocoa Powder.
     Retrieve a list of all smoothies matching these criteria.
unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area
Tagged with: ,

The Coffee Shop – Price Calculator

Your local coffee shop would like to set up a touchscreen tablet on the counter for the baristas to quickly calculate the cost of the cups of coffee ordered by the customers.

Here are the options available when ordering a coffee:

The new system will need a computer program to let a barista pick up the order details. The barista should be able to specify:

     The type of coffee being ordered: There are 7 options: Espresso, Americano, Latte, Cappuccino, Macchiato, Mocha and Flat White
     The size of their coffee cup. Per default a coffee comes in a medium cup, however a customer may ask of a large or an XL cup.
     Whether they would like to eat in or take their coffee away

Based on the user inputs and the price list provided above, the system should automatically calculate and display the total price of the chosen cup of coffee.

Step 1: Draw a Flowchart for your algorithm

Before attempting to complete the code for this task, grab a piece of paper and draw the flowchart to identify the key inputs, decisions and calculations for your algorithm.

Alternatively, you can also create your flowchart online:
Flowchart Studio

Step 2: Complete the Python Code

Complete the Python code below.

Step 3: Add validation checks

To make your program more robust, add some validation rules on your inputs so that:

     The barista can only enter one of the seven options when entering the type of coffee.
     The barista can only opt for M, L or XL when entering the size of the cup.
     The user can only enter Yes or No when asked whether they would like to opt for the takeaway option.

You can find out more about implementing validation checks in Python using this page (input validation tab).

Step 4: Test Plan

Once your code is complete, test it using the following test plan to make sure all your calculations are correct!

Test # Input Values Expected Output Pass / Fail
#1 Type of Coffee: Espresso
Cup Size: L
Takeaway? Yes
Coffee Cup Price: £4.50
#2 Type of Coffee: Cappuccino
Cup Size: M
Takeaway? No
Coffee Cup Price: £3.00
#3 Type of Coffee: Mocha
Cup Size: XL
Takeaway? Yes
Coffee Cup Price: £6.00
#4 Type of Coffee: Flat White
Cup Size: XL
Takeaway? Yes
Coffee Cup Price: £5.00
#5 Type of Coffee: Breakfast Tea
Cup Size: L
Takeaway? Yes
Invalid option. Please select a type of coffee from the menu.

Ordering Multiple Coffees…

We would like you to improve this system so that when a customer order multiple coffees, the barista can enter all the details for the different coffees being ordered and the system works out the total cost of the order.

These are the three amendments you will have to make to your code:

     Your system should start by asking the barista how many cups of coffees are being ordered.
     Then for each coffee, the barista will enter the details (Type of drink, cup size, takeaway?)
     The system will calculate and output the total price of the order.
unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

School Room Finder

Your school is organising an open evening event where prospective parents will be able to visit the different classrooms and departments to get to find out more about the school and meet with the teachers. Parents have been given a list of rooms and activities going on during this open evening. The school will use students leaders to help guide the parents between the different buildings. The school would also like to develop an App for parents to use on their phones to help them locate a room. They would like this app to:

  • Let the parent enter the name of a room (e.g. Sports Hall) or its room code (e.g. A205).
  • The App should indicate in which building this room is located and on what floor it is.

The school consists of 5 main buildings: The A Block, the B Block, the C Block, a 6th Form Block and a Sports Hall.

The A, B and C blocks have three floors. Each classroom within these blocks is given a code such as A205. The first letter of this code is referring to the building (e.g. A for A Block).
The number is based on which floor the room is on:

  • Classrooms with a number lower than 100 are on the ground floor. (e.g. A15, B7, C23)
  • Classrooms with a number between 100 and 199 are located on the first floor. (e.g. A101, B120, C119)
  • Classrooms with a number of 200 and above are located on the second floor. (e.g. A205, B220, C231)

The Sixth Form block only contains two floors: the ground floor and the first floor. Classrooms in the 6th form block have a code starting with letter S.

  • Classrooms with a number lower than 20 are on the ground floor. (e.g. S4, S15)
  • Classrooms with a number of 20 and above are located on the first floor (e.g. S20, S27)

Other rooms of the school (other than classrooms) do not have a specific code. They include the Main Reception, the Dance Studio, the Activity Studio, the Sports Hall, the Staffroom and the Canteen. These are spread around the school site within the different blocks. Specific instructions on where these are located also need to be provided by the App.

Your Task

Last year, the head of school asked one of the Computer Science GCSE students to produce the code for this App. Initially, the app was not meant to cater for the 6th From block as it was not used for the open evening. This year however, the 6th form block will be accessible by parents. The student who created the App has now passed his GCSE and left the school. We therefore need you to look at their code and complete the code to make sure that it does provide instructions to locate classrooms from the 6th form block.

A new Coffee Bar has also been created on the first floor of the C block. You will need to amend the code to also include directions to the Coffee Bar.

We have also realised an issue with the code. If a parent enters a room code for a building that does not exists (e.g. D102) the app should tell them that this room does not exist. This is not the case currently. Can you fix this code to make sure only valid room codes starting with A, B, C or S or valid room names are used.

Test Plan

To make sure your app is fully working as expected, you will have to make sure that it passes the following 10 tests!

Test # Input Values Expected Output Pass or Fail?
#1 A205 This room is located in the A Block. It is on the second floor.
#2 B14 This room is located in the B Block. It is on the ground floor.
#3 C101 This room is located in the C Block. It is on the first floor.
#4 S12 This room is located in the 6th Form Block. It is on the ground floor.
#5 S22 This room is located in the 6th Form Block. It is on the first floor.
#6 D102 We cannot locate this room! Are you sure this is a valid room?
#7 Main Reception This room is located at the main entrance of the A block.
#8 Sports Hall This room is located on the side of the B Block.
#9 Coffee Bar This room is located on the first floor of the C block.
#10 Swimming Pool We cannot locate this room! Are you sure this is a valid room?

Python Code

Here is the Python code for the App so far…

Extension Task

Adapt this whole code to make it work for your school. Find out how room codes are used and tweak the code accordingly.

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Circular Maze Challenge

The aim of this challenge is to use Python Turtle to trace a path to solve this circular maze.

By doing so we will investigate how we can draw different arcs of different radiuses and different lengths to guide the Python turtle through the maze.

Our Python code will make use of a function called drawArc() that takes three parameters:

  • The radius of the arc (in pixels)
  • The starting angle of the arc (in degrees)
  • The angle of the arc (in degrees)

To fully understand the purpose of these three parameters let’s look at the following three examples:

The third examples demonstrate how we can use a negative angle to change the direction of the arc. A positive angle draws an arc anti-clockwise, whereas a negative angle draws and arc clockwise.

Now let’s use Python Turtle to solve this challenge.

Python Code

We have started the code for you and drawn the first two arcs using our drawArc() function. Your task is to complete this code by drawing additional arc until you reach the exit gate.

To complete this challenge, you will have to use a trial and error approach, testing your code with different parameter values when using the drawArc(), forward() and setheading() functions and refining your code by tweaking these values.

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Pronic Numbers Challenge

A pronic number is a number which is the product of two consecutive integers.

For instance 42 is a pronic number because 42 = 6 x 7.

One approach to work out if a number n is a pronic number or not is to find out if there is a positive integer i lower than n that solve this equation: n = i(i+1).

If there is such a number i, then n is a pronic number.

Did you know?

Pronic numbers are also called oblong numbers or heteromecic numbers.

Python Challenge

Your task is to write new function called isPronic that takes one parameter, an integer value and returns True is the parameter is a pronic number, False otherwise.

You should then write a small program that will:

     Prompt the user to enter a number.
     Use the isPronic function to find out is the number entered is pronic or not.
     Produce a meaningful output to the end-user.

Extra Challenge

Reuse your function to write a new Python program that outputs all the pronic numbers between 0 and 1,000!

Python Code

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area