Table of contents
- ECX 3.0 30 Days of Code and Design Python Challenge
- Day 1 - List to Set
- Day 2 - Find the mode
- Day 3 - Palindromic Numbers
- Day 4 - Decimal to Hexadecimal
- Day 5 - Fibonacci
- Day 6 - Man in the Well
- Day 7 - Wordle
- Day 8 - Caesar Cipher
- Day 9 - Is Prime?
- Day 10 - USSD Bank Service
- Day 11 - Euclid's algorithm (GCD)
- Day 12 - Student or Professor
- Day 13 - What are the Acronyms?
- Day 14 - Guess the Number
- Day 15 - Magic Square
- Day 16 - When in Rome
- Day 17 - Pascal's Triangle
- Day 18 - Reverse Order
- Day 19 - Day of the Date
- Day 20 - Countdown Timer
- Day 21 - Frequency Analysis
- Day 22 - Zodiac.
- Day 23 - Sieve of Eratosthenes
- Day 24 - Bubble Sort
- Day 25 - Binary Search Algorithm
- Day 26
- Day 27 - Maths game.
- Day 28 - Bulk E-mail
- Day 29 - GPA Calculator
- Day 30 - Sudoku Solver
- Bonus Tasks
The Engineering Career Expo (ECX) started its ECX 30 days of code and design on Tuesday, 5 April 2022 in 8 different tracks, which are;
- 3D modelling and animation
- Backend web development (Flask)
- Backend web development (Laravel)
- Data analytics
- Frontend web development
- Game development
- UI/UX
The beauty of the challenge was that a WhatsApp support group was created, which gave participants access to the tutors. As a learner of the python programming language, I chose to participate in the python track, and it was a wonderful experience. At the time, I was learning regular expressions, and using regex to solve some of the questions made it more interesting. I got to explore Wikipedia, Google, and Stack Overflow when I get stuck, but that made it all interesting. I learnt new things like reversing a string, comb() module, multimode() module, palindromes, etc.
In all, it was interesting. A big thank you to Edwin, the python head tutor, and his team for the backlinks explaining the more difficult tasks.
Thank you, Daniel Ejalonibu (Chairman of ECX 3.0), and your team for this opportunity to learn and grow. T for thanks.
Below are links to articles on how I approached each challenge. I had chosen not to write on the day 22 challenge (for personal reasons), and the day 27 challenge because I have written an article on a similar but more challenging problem. For day 28, the code I initially wrote is failing to work due to Gmail's recent changes with respect to using less secured app (if you have any idea on how I can work on it, please tell me in the comment section. Thank you).
ECX 3.0 30 Days of Code and Design Python Challenge
Day 1 - List to Set
Create a function that takes in a list as input, and returns (and prints) a new list with all repetitions reduced to one appearance alone, as output.
Day 2 - Find the mode
Extend the function from day 1, to also print out the modal element(s) of the input list, i.e., to determine which element occurs the most. If there are multiple such elements, then return a list containing them all.
Day 3 - Palindromic Numbers
Write a function that prints out all palindromic numbers less than a given input, and returns the total number of palindromes found.
Day 4 - Decimal to Hexadecimal
Without using the inbuilt hex() function, write a function that takes an integer as input and prints out its conversion to Hexadecimal as output.
Day 5 - Fibonacci
Using recursion, write a function that prints out the first "n" members of the Fibonacci series.
Day 6 - Man in the Well
A man is stuck at the bottom of a well. Each day, he climbs up 8 metres, and then at night, he slips downwards by 3 metres. Using loops (any loop of your choice), write a function to determine (and print) how many days it takes for him to climb out of a well of any given depth, where the depth of the well is taken as input.
Day 7 - Wordle
Make a Wordle game. Wordle is a single-player game, in which a user is required to guess a 5-letter hidden word in 6 attempts.
Day 8 - Caesar Cipher
A Caesar cipher is an ancient form of encryption. It involved taking a text (a string) as input and encoding it by replacing each letter with the one n-steps next to it in the alphabet. (E.g., shifting "Python" by 5 becomes "Udymts." Note that this "shift", wraps around, which is why "y" becomes "d").
Day 9 - Is Prime?
Write a function that takes an integer as input and determines whether it is a prime number or not.
Day 10 - USSD Bank Service
Create a mock USSD service that takes user input, and provides appropriate responses (allowing users to check account balance, transfer funds, and purchase airtime).
Day 11 - Euclid's algorithm (GCD)
Write a program that asks the user for two numbers and computes their GCD using Euclid's algorithm.
Day 12 - Student or Professor
At a certain school, student email addresses end with @student.college.edu
, while professor email addresses end with @prof.college.edu
. Write a program that first asks the user how many email addresses they will enter, and then have the user enter those addresses. After all the email addresses are entered, the program should print out a message indicating exactly how many student and professor emails were entered.
Day 13 - What are the Acronyms?
Write a program that does the following:
- Ask the user to enter (input) a sentence containing an acronym or more
- Print out a list containing all acronyms in the sentence
Day 14 - Guess the Number
Create a number guessing game in which the player is to guess the unknown number (which ranges from 1 to 50) within 5 guesses.
Day 15 - Magic Square
A Magic Square is a 3*3 grid, such that:
- It contains all the numbers 1 through 9
- The sum of each row, each column, and each diagonal all add up to the same number
Day 16 - When in Rome
Write a function that takes an integer as input, and returns its translation to Roman numerals.
Day 17 - Pascal's Triangle
Write a function that prints out the first "n" rows of Pascal's triangle, where "n" is an integer taken as an argument of the function.
Day 18 - Reverse Order
Write a function that takes a string as input, and returns a string similar to the input, but with the words in reverse order, and the punctuation marks maintaining their original order.
Day 19 - Day of the Date
Write a function that takes in date as input, and returns what day of the week it is.
Day 20 - Countdown Timer
Create a countdown timer which beeps when the time is up.
Day 21 - Frequency Analysis
- Write a function that takes a string as input and:
Returns a dictionary whose keys are the characters found in the text, and whose values are the number of occurrences of that character in the text.
E.g.: f("It is good!") => {"I": 2, "t": 1, "s": 1, "g":1, "o":2, "d":1, "!":1} - Write ANOTHER function that takes an input string and returns a dictionary whose keys are the words in the text, and whose values are the respective frequencies of these words.
E.g.: f("It is not good, is it?") => {"It": 2, "is": 2, "not": 1, "good":1}
Note: In both cases, disregard case sensitivity.
Day 22 - Zodiac.
Extend the function from day 19 to return BOTH the day of the week and the corresponding "Zodiac sign" of the input date. The return value can be a list or any convenient structure. All rules relating to task 19 still apply.
Day 23 - Sieve of Eratosthenes
The sieve of Eratosthenes is an ancient algorithm for finding all primes less than a given value N.
Day 24 - Bubble Sort
"Bubble sort" is a basic algorithm for sorting (rearranging in ascending or descending order) elements in a list.
Day 25 - Binary Search Algorithm
Binary search is a basic algorithm used to find the position of a target value within a sorted list.
Day 26
We rested.
Day 27 - Maths game.
Using Python, create a game with the following rules:
- A (randomly generated) basic algebraic expression is displayed on the screen. E.g.; 36×47, or 117 ÷ 9, etc.)
- The user is required to provide an answer to the expression within 10 seconds.
- If the user provides a RIGHT answer, he gains {10×(the number of seconds left)} points
- If the user provides a WRONG answer, or the time elapsed, the player loses a life.
- At the start of the game, the player provides his name and begins playing with 3 lives.
- The player loses once he has exhausted his 3 lives.
Note:
- Only +,-,×,÷ operations are allowed.
- In the case of a division operation, the two numbers generated must be divisible.
Read the Timed Mental Maths Game (A similar but more complex problem).
You can view the code of my approach to day 27. I made use of the PyInputPlus module in it. Kindly use it to compare the Timed Mental Maths Game.
Day 28 - Bulk E-mail
Using the built-in SMTP module, write a function that takes a list of emails as input, and sends each of them an(any) email message.
If you have any idea on how I can go about this challenge. Kindly let me know. Thank you.
Day 29 - GPA Calculator
Write a function that: 1) Takes as parameters, a list of tuples, containing grades and their corresponding units. (E.g.: [ ("A", 2), ("A",3), ("B", 2) … etc.]) 2) Computes and returns the student GPA, based on the values provides.
Day 30 - Sudoku Solver
Create a sudoku solver.
Bonus Tasks
Do try out the challenges. If you run into any problem, do leave a comment. If you have any suggestions, please also leave a comment. Thank you.