Tag: Function

Radians to Degrees Conversions


The radian is a unit of measure for angles used mainly in trigonometry. It is used as an alternative to degrees. Whereas, in degrees a full circle is 360 degrees, in radians a full circle is 2π radians: It is

Triangle Geometry Functions


In this challenge we will create a library of functions to apply the different formulas based on the geometry of triangles. For each function, you will need to design the algorithm using either Pseudo-code or a flowchart, implement the function

Heron’s Formula


The Heron’s formula is a famous formula used to calculate the area of a triangle based on the length of its three sides. It is called “Heron’s Formula” (sometimes called Hero’s formula) after Hero of Alexandria who was a Greek

Linear Search Functions


For this programming challenge we will investigate different functions which will all be based on a linear search algorithm. Let’s consider a teacher who has decided to keep track of rewards issued to their students throughout the term by adding

Leap Year Subroutine

A leap year is a calendar year that contains an additional day (29th of February) added to keep the calendar year synchronised with the astronomical year or seasonal year (which contains roughly 365¼ days or 365.242375 days to be more

Connect4 Challenge

Connect4 Data Structure using a 2D-array

In this blog post you will use HTML, CSS, and JavaScript to complete this game of connect 4 for two players. (Rules of the game) You will first need to reverse-engineer the code provided. The code so far is used

Football Formation


The purpose of this challenge is to understand how subroutines (functions/procedures) are used in Python to create sections of code that can be called/reused many times within a program. Subroutines mean that a section of code can be identified using

Cinema Booking Challenge

A cinema has created a booking system for their main theatre which consists of 48 seats, organised in 6 rows of 8 seats. To store information as to whether a seat is booked or available, the program uses a 2-dimensional

Professor Snape’s Magic Potions


In this challenge we will use file handling techniques to read through and access the content of different text files. We have saved three recipes for the following three magic potions using one text file per recipe: Invisibility Potion: A

Haunted House


You are going to write a Python game where the user walks within the different rooms of a haunted house. In each room, something will happen. You will decide what happens when the user enters a room. You can use