-
Ryerson letter gradeCreated: Sep 08, 2024Difficulty: EasyType: TextTags: Algorithms Math Parsing
Before the name change in the year 2022, Toronto Metropolitan University was known as Ryerson University. Given the percentage grade, calculate and return the letter grade that would appear in the Ryerson grades transcript. This letter grade should...
Read more -
Ascending listCreated: Sep 08, 2024Difficulty: EasyType: TextTags: Data Structures Algorithms Sequences
Determine whether the sequence of items is strictly ascending so that each element is strictly larger (not just merely equal to) than the element that precedes it.
Read moreReturn True
if the elements in the list of items are strictly ascending,... -
Riffle shuffle kerfuffleCreated: Sep 08, 2024Difficulty: HardType: TextTags: Algorithms Simulation Sequences
Given a list of items whose length is guaranteed to be even (note that “oddly” enough, zero is an even number), create and return a list produced by performing a perfect riffle to the items by interleaving the items of the two halves of the list...
Read more -
Even the oddsCreated: Sep 08, 2024Difficulty: EasyType: TextTags: Algorithms Math Number Theory Pattern Matching
Check that the given positive integer n contains only odd digits (1, 3, 5, 7 and 9) when it is written out.
Read moreReturn True
if this is the case, andFalse
otherwise. Note that this question is not asking whether the number n itself is odd or even. Yo... -
Cyclops numbersCreated: Sep 08, 2024Difficulty: EasyType: TextTags: Algorithms Math Number Theory Pattern Matching
A nonnegative integer is said to be a cyclops number if it consists of an odd number of digits so that the middle (more poetically, the “eye”) digit is a zero, and all the other digits of that number are non zero. This function should determine wheth...
Read more -
Domino cycleCreated: Sep 08, 2024Difficulty: EasyType: TextTags: Data Structures Algorithms Combinatorics Simulation
A single domino tile is represented as a two-tuple of its pip values, such as (2,5) or (6,6). This function should determine whether the given list of tiles forms a cycle so that each tile in the list ends with the exact same pip value that its succe...
Read more -
Colour trioCreated: Sep 08, 2024Difficulty: MediumType: TextTags: Algorithms Math Combinatorics Simulation
This problem was inspired by the Mathologer video
Read more“Secret of Row 10”
. To start, assume the existence of three values called “red”, “yellow” and “blue”. These names serve as colourful (heh) mnemonics and could as well have been 0, 1, and 2, or “foo”... -
Count dominatorsCreated: Sep 08, 2024Difficulty: MediumType: TextTags: Data Structures Algorithms Optimization Loops
An element in a list of items is a dominator if every element to its right (not just the one element immediately to its right, but all of them) is strictly smaller than that element. Note how according to this definition, the last item of the lis...
Read more -
Beat the previousCreated: Sep 08, 2024Difficulty: EasyType: TextTags: Data Structures Algorithms Sequences Optimization
Given a string of digits guaranteed to only contain ordinary integer digit characters 0 to 9, create and return the list of increasing integers acquired from reading these digits in order from left to right. The first integer in the result list is ma...
Read more -
Identify Parameter TypeCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Basics
Write a function that takes a parameter and returns the type of the variable as a string. The function should accept one parameter and return a string indicating whether the variable is of type
int
,float
orstr
.Constraints:
- The input will...
-
Variable CastingCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Math Basics
Write a function that takes two parameters: a value and a type to cast to. The function should cast the input value to the specified type and return the result. This problem is
Read moredesigned to help you practice variable casting and type conversion
betw... -
Even or Odd NumberCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Math Basics
Write a function that takes an integer and returns
Read more"Even"
if the number is even, or"Odd"
if the number is odd. This problem isdesigned to help you practice using if statements and modulo operations
. The function should accept one parameter an... -
Compare Two NumbersCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Math Basics
Write a function that takes two numbers and returns a string indicating their comparison result. The function should accept two parameters and return:
-
"Greater"
if the first number is greater than the second. -
"Less"
if the first number is le...
-
-
Get Nth Character of a StringCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: String Manipulation Basics
Write a function that takes a string and a position (index) and returns the character at that position in the string. This problem is
Read moredesigned to help you practice string indexing
. The function should accept two parameters and return the character... -
Reverse a StringCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: String Manipulation Basics
Write a function that takes a string and returns the string reversed. This problem is
designed to help you practice string manipulation and slicing
. The function should accept one parameter and return the reversed string.Constraints:
- The input...
-
Check Substring in StringCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: String Manipulation Basics
Write a function that takes two strings and returns
Read moreTrue
if the second string is a substring of the first string, orFalse
otherwise. This problem isdesigned to help you practice string searching
. The function should accept two parameters and... -
String ConcatenationCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: String Manipulation Basics
Write a function that takes two strings and returns a new string that is the concatenation of the two input strings. This problem is
Read moredesigned to help you practice string concatenation
. The function should accept two parameters and return the concat... -
Formatted StringCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: String Manipulation Basics
Write a function that takes a context string and a value, and returns a formatted string combining both. This problem is
designed to help you practice string formatting
. The function should accept two parameters and return the formatted string.Co...
Read more -
Sum of Elements in a ListCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Data Structures Basics
Write a function that takes a list of numbers and returns the sum of all the elements. This problem is
Read moredesigned to help you practice working with lists and basic iteration
. The function should accept one parameter and return the sum of the elements... -
Find the Largest Element in a ListCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Data Structures Basics
Write a function that takes a list of numbers and returns the largest element. This problem is
designed to help you practice working with lists and finding maximum values
. The function should accept one parameter and return the largest element.Co...
Read more -
Reverse a ListCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Data Structures Basics
Write a function that takes a list and returns a new list with the elements in reverse order. This problem is
Read moredesigned to help you practice working with lists and reversing sequences
. The function should accept one parameter and return the reversed... -
Sort a ListCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Data Structures
Write a function that takes a list of numbers and returns a new list with the elements sorted in ascending order. This problem is
Read moredesigned to help you practice using built-in sorting methods
. The function should accept one parameter and return the... -
Remove Specified ItemCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Data Structures Basics
Write a function that takes a list and a value, and returns a new list with all occurrences of the specified value removed. This problem is
Read moredesigned to help you practice removing items from lists
. The function should accept two parameters and retur... -
Join Two ListsCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Data Structures Basics
Write a function that takes two lists and returns a new list that is the concatenation of the two input lists. This problem is
designed to help you practice joining lists
. The function should accept two parameters and return the combined list.Con...
Read more -
Find Item in ListCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Data Structures Basics
Write a function that takes a list and a value, and returns
Read moreTrue
if the value is in the list, orFalse
otherwise. This problem isdesigned to help you practice searching for items in lists
. The function should accept two parameters and return a... -
Access Dictionary ItemCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Basics
Write a function that takes a dictionary and a key, and returns the value associated with the key. This problem is
Read moredesigned to help you practice accessing values in dictionaries
. The function should accept two parameters and return the value corres... -
Add Item to DictionaryCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Basics
Write a function that takes a dictionary, a key, and a value, and returns a new dictionary with the key-value pair added. This problem is
Read moredesigned to help you practice adding items to dictionaries
. The function should accept three parameters and re... -
Remove Item from DictionaryCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Basics
Write a function that takes a dictionary and a key, and returns a new dictionary with the specified key removed. This problem is
Read moredesigned to help you practice removing items from dictionaries
. The function should accept two parameters and return th... -
Find Numbers from N to 1Created: Sep 14, 2024Difficulty: BeginnerType: TextTags: Loops Basics
Write a function that takes a positive integer N and returns a list of numbers from N down to 1. This problem is
Read moredesigned to help you practice looping backwards using a for loop
. The function should accept one parameter and return the list of numbe... -
Custom Step In For LoopCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Loops Basics
Write a function that takes a start number, an end number, and a step size, and returns a list of numbers starting from the start number up to but not including the end number, incremented by the step size. This problem is `designed to help you pract...
Read more -
Find Even NumbersCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Loops Basics
Write a function that takes two integers, start and end, and returns a list of all even numbers between start and end (inclusive). This problem is
Read moredesigned to help you practice using for loops and conditionals
. The function should accept two parame... -
FactorialCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Loops Basics
Write a function that takes a positive integer N and returns its factorial calculated using a for loop. This problem is
Read moredesigned to help you practice using for loops for calculations
. The function should accept one parameter and return the factoria... -
Sum of NumbersCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Basics
Write a function that takes a positive integer N and returns the sum of all numbers from 1 to N using a while loop. This problem is
designed to help you practice using while loops
. The function should accept one parameter and return the sum.Const...
Read more -
Reverse a NumberCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Basics
Write a function that takes a positive integer N and returns its reverse using a while loop. This problem is
Read moredesigned to help you practice using while loops and working with numbers
. The function should accept one parameter and return the reversed... -
Fibonacci SequenceCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Basics
Write a function that takes a positive integer N and returns a list containing the Fibonacci sequence up to N terms using a while loop. This problem is
Read moredesigned to help you practice using while loops and generating sequences
. The function should ac... -
Count Digits in a NumberCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Basics
Write a function that takes a positive integer N and returns the number of digits it contains using a while loop. This problem is
Read moredesigned to help you practice using while loops and working with numbers
. The function should accept one parameter and... -
Find All Prime NumbersCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Basics
Write a function that takes two integers:
Read morestart
and anend
(interval definition, exclusive) and returns all identifiedprime numbers
in alist
. You should create a helper function to perform the primality check. This problem is `designed to h... -
Find PowersCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Basics
Write a function that takes two parameters: a
Read morelist of integers
and aninteger
exponent. The objective is to return alist of integers
where each of the provided numbers have been raised to the power of the exponent. You should use the provided... -
A Primitive CalculatorCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Math Basics
Implement a primitive calculator that accepts some
Read moreoperation code
with two parametersoperand1
andoperand2
. This problem isdesigned to help you practice using and calling custom functions
. The helper functions should accept two parameters... -
Find PalindromesCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Basics
Write a function that takes a list of words and identifies which words are palindromes. This problem is
designed to help you practice creating and calling custom functions
. The helper function should accept one word and return a boolean value.Con...
Read more -
Calculate Age from BirthdateCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Basics
Write a function that takes a birthdate as a string in the format "YYYY-MM-DD" and returns the age in years as an integer. This problem is
Read moredesigned to help you practice working with dates and calculating time differences
. The function should accept... -
Add Days to DateCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Basics
Write a function that takes a date string in the format "YYYY-MM-DD" and an integer number of days to add. The function should return a new date string in the same format after adding the specified number of days. This problem is `designed to help yo...
Read more -
Days Between DatesCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Basics
Write a function that takes two date strings in the format "YYYY-MM-DD" and returns the number of days between them as an integer. This problem is
Read moredesigned to help you practice calculating the difference between dates
. The function should accept tw... -
Format TimeCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Basics
Write a function that takes a time string in the format "HH:MM:SS" and returns it in 12-hour format with AM/PM. This problem is
Read moredesigned to help you practice time formatting
. The function should accept one parameter and return the formatted time as... -
Is Leap YearCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Basics
Write a function that takes a year as an integer and returns
Read moreTrue
if it is a leap year, orFalse
otherwise. This problem isdesigned to help you practice working with dates and leap year calculations
. The function should accept one parameter an... -
Find Minimum of Two NumbersCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Basics
Write a function that takes two numbers and returns the minimum of the two using built-in functions. This problem is
Read moredesigned to help you practice using built-in functions for finding minimum values
. The function should accept two parameters and re... -
Find Maximum of Two NumbersCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Basics
Write a function that takes two numbers and returns the maximum of the two using built-in functions. This problem is
Read moredesigned to help you practice using built-in functions for finding maximum values
. The function should accept two parameters and re... -
Calculate Power of a NumberCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Basics
Write a function that takes two numbers, base and exponent, and returns the result of raising the base to the power of the exponent using built-in functions. This problem is
Read moredesigned to help you practice using built-in functions for exponentiation
.... -
Calculate Absolute ValueCreated: Sep 14, 2024Difficulty: BeginnerType: TextTags: Basics
Write a function that takes a number and returns its absolute value using built-in functions. This problem is
Read moredesigned to help you practice using built-in functions for calculating absolute values
. The function should accept one parameter and retur...