Tasks
The core of each module is the assessment and tasks section. You are expected to complete each task in the stipulated time.
For this introductory module, we will test your coding skills and thinking faculties. It is advised you understand the problem and solve it by yourself. We encourage you to google and research for answers, but plagiarism is highly frowned upon and discouraged as this will invoke penalties that will lower your chances of recommendation from our senior engineers.
Use whatever language you are comfortable with to complete these tasks
1. FizzBuzz Classic
The seminal classical coding challenge. You should be able to complete this without even having to google for the answers if you know any programming language basics. This is a classic coding challenge that tests basic programming logic.
The task is to write a program that prints the numbers from 1 to 100, but for multiples of three, it should print "Fizz" instead of the number, and for multiples of five it should print "Buzz". For numbers which are multiples of both three and five, it should print "FizzBuzz".
Level 1 Challenge
Write a program that prints the numbers from 1 to 100, but for multiples of three, it should print "Fizz" instead of the number, and for multiples of five it should print "Buzz". For numbers which are multiples of both three and five, it should print "FizzBuzz".
Level 2 Challenge
Rewrite the program to print the numbers from 1 to n, where n is an integer entered by a user, but for multiples of three, it should print "Fizz" instead of the number, and for multiples of five it should print "Buzz". For numbers which are multiples of both three and five, it should print "FizzBuzz".
Level 3 Challenge
Rewrite the program to print the numbers from 1 to n, where n is an integer entered by a user, but for multiples of m, where m is an integer entered by a user, it should print "Fizz" instead of the number, and for multiples of x, where x is an integer entered by user, it should print "Buzz". For numbers which are multiples of both m and x, it should print "FizzBuzz".
You can call the variables n, m, and x
whatever you like. Just make sure it is professional and not profane.
2. Hard Drive Size
If you buy a 40 GB hard drive, then chances are that the actual storage on the hard drive is not 40 GB.
This is due to the fact that, typically, a manufacturer uses 1,000 bytes as the value of 1K bytes, 1,000 K bytes as the value of 1 MB, 1,000 MB as the value of 1 GB. Therefore, a 40 GB hard drive contains 40,000,000,000 bytes.
However, in computer memory, 1 KB is equal to 1,024 bytes, and so on. So the actual storage on a 40 GB hard drive is approximately 37.25 GB. (You might like to read the fine print next time you buy a hard drive.)
Write a program that prompts the user to enter the size of the hard drive specified by the manufacturer, on the hard drive box, and outputs the actual storage capacity of the hard drive.
3. Milky Way
A milk carton can hold 3.78 liters of milk. Each morning, a dairy farm ships cartons of milk to a local grocery store. The cost of producing one liter of milk is ₦250, and the profit of each carton of milk is ₦180. Write a program that does the following:
Level 1
- Prompts the user to enter the total amount of milk produced in the morning.
- Outputs the number of milk cartons needed to hold milk. (Round your answer to the nearest integer.)
- Outputs the cost of producing milk.
- Outputs the profit for producing milk.
Level 2
Redo the Programming Exercise above so that the user can also input the cost of producing one liter of milk and the profit on each carton of milk.
4. Painting Job
A room has one door, two windows, and a built-in bookshelf and it needs to be painted. Suppose that one gallon of paint can paint 120 square feet. Write a program that prompts the user to:
Level 1
- input the lengths and widths of the door, each window, the bookshelf; and the length, width, and height of the room (in feet).
The program outputs the amount of paint needed to paint the walls of the room.
Level 2
Modify the Program so that the user can also specify the area that can be painted with one gallon of paint.
5. Change Creator
Write a function that finds the currencies to be used for a given balance. The currencies are the current nigerian notes ie: 1000, 500, 200, 100, 50, 20, 10, 5
Your function paramaters are as follows:
INPUT: an integer
OUTPUT: a string telling the amount of each currency needed
Write a program that prompts the user to:
Level 1
- enter the amount that needs to be changed
The program should output a string telling the amount of each currency needed to create change.
Level 2
Modify the Program so that the user can also specify the amount of each currency available. If change cannot be made, it should return the amount of each currency needed to create change and the remaining balance that was not changed.
Level 3
Coming Soon
6. Word Search Algorithm
Write a function or set of functions that finds the word entered by a user in a word search.
Your function paramaters are as follows:
INPUT: an 18 x 18 matrix representing the puzzle i.e a list containing 18 lists which contain 18 characters each.
OUTPUT: If it finds the word, it should return the position of the word. If it doesnt find the word, it should simply return a message saying word was not found
puzzle = [
['P','G','T','H','S','S','M','A','L','L','F','O','R','W','A','R','D','J'],
['U','N','T','T','O','N','H','E','I','R','N','B','T','M','V','E','E','W'],
['Y','I','D','R','H','O','O','N','G','C','E','U','E','T','I','R','S','O'],
['A','S','R','O','U','R','P','I','O','N','O','B','S','N','S','R','L','R'],
['L','S','A','U','P','O','E','A','T','E','I','C','O','E','C','O','A','H'],
['R','A','U','T','O','R','C','E','M','U','O','L','Y','U','O','H','M','T'],
['E','P','G','O','I','H','O','I','P','R','T','F','B','G','N','D','D','E'],
['Y','B','G','F','N','R','T','V','E','O','A','I','N','B','R','D','U','E'],
['A','T','N','B','T','S','E','B','E','S','I','I','T','A','I','M','N','R'],
['L','S','I','O','S','K','O','T','N','R','L','N','W','S','A','R','K','F'],
['P','I','T','U','E','A','T','E','R','E','T','R','T','E','B','B','D','S'],
['B','S','O','N','R','A','A','T','V','A','O','I','T','E','L','U','H','L'],
['L','S','O','D','W','K','E','A','A','F','U','S','M','J','R','O','S','A'],
['O','A','H','S','E','K','R','F','R','M','E','Q','R','E','T','N','E','C'],
['C','L','S','R','S','T','O','E','B','A','C','K','B','O','A','R','D','S'],
['K','L','S','A','N','U','W','G','A','M','E','M','I','T','F','L','A','H'],
['A','A','B','C','L','O','C','K','I','R','E','F','E','R','E','E','S','M'],
['I','B','T','H','P','T','E','N','D','R','A','U','G','T','N','I','O','P'],
]
tableLength = 18
tableHeight = 18
def displayTable():
for row in range(0,18):
for column in range(0,18):
print(puzzle[row][column], end=' ')
if column == 17:
print('\n')
def displayResultTable(positions):
for row in range(0,18):
for column in range(0,18):
puzzle[row][column] = '0'
print(puzzle[row][column], end=' ')
if row == positions[0][0] and column == positions[0][1]:
print(puzzle[row][column], end=' ')
#displayTable()
word = str(input("Enter the word to search for in UPPERCASE: "))