Weekly Coder
95 subscribers
84 photos
6 videos
1 file
73 links
Byte sized weekly coding challenges to hone your problem-solving prowess.
Download Telegram
πŸ–‡ Seven Million Three Hundred Twenty One Thousand Three Hundred and Sixty-Four

That's how long it has been since the creation of @WeeklyCoder β€” in seconds.

Got a straight forward challenge practice for ya this week.

πŸ₯… Goal: Make a number to Words converter. A user enters a number (as figures) and your program converts it to text (as words). Here's an example.

✏️ Recommended studying:
- arrays, stringList, stringDict ()
- % (modulo), / (division)

🦢 Quick Start:
- Get the quick-start code here.

✨ Make it even more exciting:
- let it handle negative numbers
- let it handle decimal point
- make it into a quiz game and let your young siblings learn [A number appears as text of a randomly generated integer and they get to type it out as figures]
- twist it into currency conversion [use APIs? Resource 1 | Resource 2]

πŸ“… Submissions: Sunday, 12:00 LT Afternoon

πŸͺ Send your submissions in the comments.

@WeeklyCoder | Week 13
πŸ‹ Matches of the Lemon!

Got such a simple and easy game for you this week!

πŸ“— With the price of lemons skyrocketing, people may soon resort to digital matchmaking during Ketera.

πŸ₯… Goal: To create a simple random number guessing game but with a twist of Lemons.

🐾 Steps: Let three identical lemons appear on the screen when the game starts. A player clicks on any at random and find out if they're in luck for a sweet match.

✏️ Recommended learning:
- PImage, loadImage ()
- mouseReleased ()
- loops

🦢 Quick Start:
- Get the quick-start code from here.

✨ Make it more exciting:
- Give a second chance for first wrong guesses
- Introduce stages such that a winner is a player who guessed three stages in a row
- Multiplayer mode where you secretly select a lemon and let a someone else find it. It's a match if it's a match! ;)

πŸ“… Submissions: Sunday, 12:00 LT Afternoon

πŸͺ Send your submissions in the comments.

@WeeklyCoder | Week 14
πŸ§‘β€πŸŒΎ Alleles Alleles Alleles

Challenge for this week is so light and easy it can hardly stay grounded.

πŸ’‘ Intro: An allele is one of multiple versions of DNA sequence at a given genomic location.

πŸ₯… Goal: Given a genotype (represented by a pair of alleles, e.g. GG) as input from a user, display the conditions for that genotype. i.e. whether an individual is Homozygous* or Heterozygous** for that allele.

*Homozygous: If the two alleles are the same, e.g., DD
**Heterozygous: If the alleles are different, e.g., Dd

🐾 Steps: Take a two character String input from a user. Compare the two characters to decide the condition of the genotype.

✏️ Recommended learning:
- .charAt ()
- .toUpperCase (), toLowerCase (), .equals ()

🦢 Quick Start:
- Get the quick-start code from here.

✨ Just a dab of challenge:
- Determine also whether the genotype expressed is Dominant or Recessive.

πŸ“… Submissions: Sunday, 12:00 LT Afternoon

πŸͺ Send your submissions in the comments.

@WeeklyCoder | Week 15
√ It's Punnett Square Time!

Punnett squares measure the probability of a genetic outcome resulting from a genetic cross.

πŸ₯… Goal: Given two genotype (represented by pairs of alleles, eg. TT and Tt) as input from a user, display the possible combinations of alleles of two parents.

🐾 Steps: Start with taking two character String inputs from a user. Cross them and print the output on console or canvas. Count the resulting offspring's types and display probabilities for each.

✏️ Recommended learning:
- Escape Sequence
- .charAt ()
- .toUpperCase (), toLowerCase (), .equals ()
- for loops, arrays, selection statements

πŸŽ’ Resources:
- Example: here
- Short video (<3min): here
- Articles: Here 1 | Here 2

🦢 Quick Start:
- Get the quick-start code from here.

✨ Dabs of challenges: here

πŸ“… Submissions: Sunday Morning, 2:00 LT

πŸͺ Send your submissions in the comments.

@WeeklyCoder | Week 16
πŸ’ͺ Confidence comes after mastering the fundamentals.

I look back to Times Table as one of the first things that started my love for Math back in elementary school.

The sense of accomplishment that came with memorizing and understanding the times table sparked my curiosity and enthusiasm for exploring further mathematical ideas and challenges.

πŸ’‘ Not to be mistaken for being too easy to do, this week's coding challenge dares you to be creative while creating the humble Times Table.

πŸ₯… Goal: To create a program that generates and displays the times table for any given range of numbers. For instance, an input of 12 would generate and display a 12 x 12 Times Table.

✏️ Recommended Learning:
- for loop
- textSize (), textAlign ()
- textFont (), createFont ()

🦢 Quick Start:
- Get the quick-start code from here.

✨ Dabs of challenges: here

πŸ“… Submissions: Sunday Morning, 2:00 LT

πŸͺ Send your submissions in the comments.

@WeeklyCoder | Week 17
🐚 Fibonacci Time!

Got ya a breeze this week!

πŸ’‘ The Fibonacci sequence can be used to describe the number of petals on a flower, paintings, structural design, human anatomy, and more.

πŸ–‹ It is a sequence in which each number is the sum of the two preceding ones.

It begins like this: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ...

πŸ₯… Goal: Print the first n Fibonacci sequence.

✏️ Recommended Learning:
- for loop

🦢 Quick Start:
- Get the quick-start code from here.

✨ Make it more exciting:
- Check whether a given number is a Fibonacci number

πŸ“… Submissions: Sunday Morning, 2:00 LT

πŸͺ Send your submissions in the comments.

@WeeklyCoder | Week 18
πŸ‘2
βž— Wait! But can you divide?

Easy as it is, don't mistake this week's challenge for being too straight forward.

πŸ₯… Goal: Make a program to keep dividing two given numbers until a given number of digits are obtained after the decimal point β€” just as you would do a long division by hand.

Find example and more here.

🧠 Needless to say, the point is not the answer but your approach. Seek not for a shortcut with this one.

πŸ§ͺ Testing numbers: 31/13, 1089/23

✏️ Recommended Learning:
- loops
- Arithmetic operators (esp. / % )
- Division by Integer

🦢 Quick Start:
- Get the quick-start code from here.

✨ Make it more robust:
- Make it into a function that returns a String. Eg: divide (31, 13, 50) to mean 31/13 and give 50 digits after the decimal point.
- Support for floating point inputs
- Support for negative numbers
- Handle exceptions such as division by 0

πŸ“… Submissions: Sunday Morning, 2:00 LT

πŸͺ Send your submissions in the comments.

@WeeklyCoder | Week 19
πŸ’΄ "10α‰₯ር ካለሽ 50α‰₯ር ልመልሡልሽ"

That's a typical reply of minibus conductors when they're given higher denominations above the total fare.

As they are often short of changes (as smaller denominations), they would much rather give back changes as higher denominations.

Click here to find an illustrative example case.

πŸ₯… Goal: To enable a more efficient management of change (of smaller denominations).

πŸ’‘ Consider Denominations (ETB):
1, 5, 10, 50, 100, and 200

βš™οΈ Task: Click here to get the specific tasks for this coding challenge.

✏️ Recommended Learning:
- Selection statements (if, else if, else | Ternary Operator (? :)
- Arithmetic operators (+ -)

🦢 Quick Start:
- Get the quick-start code from here.

✨ Make it more robust:
- Consider where TA is < TF
- When does this technique not work
- Handle cases of Eg: TF: 370, TA: 400, AA: 20 HC: 50
- Sharing amongst multiple passengers

πŸ“… Submissions: Sunday Morning, 2:00 LT

πŸͺ Send your submissions in the comments.

@WeeklyCoder | Week 20
πŸͺ Who is the goddess of love?

She is a sign of beauty, fertility, and victory. For her, the Sun 'rises' in the West and sets in the East. β€” Venus, the planet.

One disorienting fact about Venus is that, a "day" there is 243 Earth days. What's more is, a year (one trip around the Sun) there is only 225 Earth days. Shorter than her own day!

πŸ₯… Goal: Given your age on Earth, write a program to accurately calculate how old you would be on Venus:
- [1] based on its day
- [2] based on its year

✏️ Recommended Learning:
- Variables
- Arithmetic operators (+-*/)

🦢 Quick Start:
- Get the quick-start code from here.

✨ Make it more robust:
- Let your input be a date of birth (dd-mm-yyyy) than age
- Put the results in the format i Years, j Months, k Days
- Add Hours, Months, and Seconds

πŸ“… Submissions: 30 Earth Hours away

πŸͺ Send your submissions in the comments.

Happy Women's Day!

@WeeklyCoder | Week 21
πŸ‘2
🌈 Resist Colorfully

Some have 4 bands, some 5, and some 6. The higher the number, the more accurate the value.

Color codes for resistors provides a visual method for quickly identifying the resistance value of a resistor. It's universal, easy to manufacture, familiar, and convenient.

πŸ₯… Goal: Given band colors, determine the resistance in ohms.

🎨 Color Chart here

✏️ Recommended Learning:
- Arrays
- ComboBox
- equals ()
- for loop

🦢 Quick Start:
- Get the quick-start code from here.

✨ Make it more robust:
- Give users the option to insert 4, 5, or 6 color banded resistors.

🌐 Resistor Color Code website

πŸ“… Submissions: Sunday Morning, 2:00 LT

πŸͺ Send your submissions in the comments.

@WeeklyCoder | Week 22
➰ So you think you can loop?

You really can't go wrong with mastering the fundamentals in computer programming.

Put your looping skills to the test and get creative with this week's 'pattern' creation challenge!

πŸ₯… Goal: Recreate a set of patterns with loops and selection statements.

🎨 Pattern here

✏️ Recommended Learning:
- loops
- selection statements
- variables
- for loop
- arithmetic operators

πŸ™ Special thanks to: Ethio Telecom for sponsoring delaying the posting of this week's challenge.

πŸ“… Submissions: Sunday Morning, 2:00 LT

πŸͺ Send your submissions in the comments.

@WeeklyCoder | Week 23
😁9
πŸ”‹ The Capacity to Resist

This week's challenge is so light you could do it while standing!

πŸ₯… Goal: Create a program that calculates the total resistance/capacitance of a series-parallel circuit β€” given individual values of resistors/capacitors.

πŸ”Œ Formulas and rules here

✏️ Recommended Learning:
- selection statements
- variables
- arithmetic operators

⚑️ Bring the Thunder:
- Calculating total Resistance/Capacitance for two or three R/C is one thing, but how could it be done for n Resistors or Capacitors?

πŸ“… Submissions: Sunday Morning, 2:00 LT

πŸͺ Send your submissions in the comments.

@WeeklyCoder | Week 24
5️⃣ Five Letters

This week's challenge is a word game!

Put your vocabulary and spelling skills to the test through 5 lettered words from the top 1000 words in English!

πŸ₯… Goal: Hide the two last letters of a random word from a given word bank (file), and let a user guess the word. + points if correct | - points if wrong.

✏️ Recommended Learning:
- loadStrings ()
- .length (), .size (), .trim ()
- .substring (), StringList
- keyCode
- Character.isAlphabetic ()
- .append (), .get ()
- random ()


🦢 Get started with this code.

⚑️ Bring the Thunder:
- Show counter of 'points' and 'hearts' (health bar)
- Include a 'Game Over' for too many incorrect guesses
- Introduce a count down for each new word to make it more intense

🎁 Might I break the rule for this week's challenge? πŸ€”

πŸ“… Submissions: Sunday Morning, 2:00 LT

πŸͺ Send your submissions in the comments.

@WeeklyCoder | Week 25
πŸ“– QR Dictionary

Got another vocabulary practicing game for y'all!

Why bother hiding the answer with your palm or paper when you can encode it as a QR?

πŸ₯… Goal:
Hide (encode) the meaning of a word as a QR Code that appears on the screen. To practice/play, all you have to do is take a moment to recall the meaning of the word that appears beneath the QR code and check your answer.

✏️ Recommended Learning:
- loadStrings ()
- .length (), .size ()
- StringDict ()
- keyCode, keyPressed ()
- .append (), .get ()
- random ()


🦢 Get started with this code.

⚑️ Bring the Thunder:
- Go to the next word with a keyPress, ENTER for example
- Show counter of words remaining
- Ensure that a word does not appear more than once when randomizing
- Include a count down for each new word

πŸ’‘ Nudges: Find aiding code snippets put in the folder, "nudges"

βš™οΈ Libraries: QR Code library has been included in the folder, "code"

πŸ“… Submissions: Sunday Morning, 2:00 LT

πŸͺ Send your submissions in the comments.

@WeeklyCoder | Week 26
πŸ‘¨β€πŸ’»1
⏰ Wake Up Call

I remember a small Alarm app being one of my earliest projects after getting introduced to computer programming, and specifically Processing.

Though Windows 10 has one, let's pretend we're in the Windows 7 era (as was the case for me), and create a simple alarm app.

πŸ₯… Goal: Take time (in seconds, at first) and count down to 0 and sound the alarm.

✏️ Recommended Learning:
- libraries, minim
- .play (), .pause ()
- millis ()

🦢 Get Started with this audio example code.

⚑️ Bring the Thunder:
- Move past taking duration and take as input set time in the future
- Implement the options Dismiss
- Implement the option to Snooze
- Include a custom inserted text to appear along with the alarm sound

βš™οΈ Don't forget to add the minim audio library like this.

πŸ“… Submissions: Sunday Morning, 2:00 LT

πŸͺ Send your submissions in the comments.

@WeeklyCoder | Week 27
πŸ‘¨β€πŸ’»1
4️⃣ Connect Four

Let's create another simple game as this week's Coding Challenge.

πŸ“Ό Watch this 20 second video to understand the workings of the game.

πŸ₯… Goal: Recreate the game Connect Four with your favorite programming language and environment.

✏️ Recommended Learning:
- Integer, color
- IntList, .append (), .get ()
- keyReleased (), str ()

🦢 Get Started with this starting code.

πŸ› Fix the bug: In the starting code, the disks are arranged upside down. Fix this bug to let them 'fall' down.

πŸ“… Submissions: Sunday Morning, 2:00 LT

πŸͺ Send your submissions here.

@WeeklyCoder | Week 28
πŸ‘¨β€πŸ’»1
⚠️ "Energy flows where attention goes" β€” T.R.

How much of your attention is going where you want it to when you're on a computer?

We're getting that figured on this week's coding challenge!

πŸ₯… Goal: To make a simple active window tracking program to determine the most used apps.

✏️ Recommended Learning:
- Intict, key, value
- set (), size (), get (), hasKey ()
- increment operator

🦢 Get started: Here's a starting code with the JNA library included in the 'code' folder. It contains a function to get title of the focused window.

🐾 Steps: Start by obtaining the current title of the active window. Check if the title has been stored before. If it is new, count it as one. If old, increment the prev count by 1. Sort the stored item values (counts) and get the keys (titles).

πŸ“… Submissions: Sunday Morning, 2:00 LT

πŸͺ Send your submissions here.

@WeeklyCoder | Week 29
πŸ”₯1πŸ‘¨β€πŸ’»1
πŸ“ 8.764868, 38.999322

Feather light coding challenge for y'all this week.

πŸ₯… Goal: Calculate the distance between two points on the Earth's surface given two coordinates as latitude and longitude.

✏️ Recommended Learning:
- Haversine Formula
- asin (), sin (), cos (),
- sqrt (), pow (), radians ()

🐾 Steps: Start by studying Haversine Formula. Then convert each equation to programmatic expression.

βž• Testing coordinates:
Point 1: [8.76484622069578, 38.99934027941346]
Point 2: [8.945679343541766, 39.20198679710532]

πŸ“… Submissions: Sunday Morning, 2:00 LT

πŸͺ Send your submissions in the comments.

@WeeklyCoder | Week 30
πŸ‘¨β€πŸ’»1
⚑️Counting Flashes

Digital electric meters have an LED that flashes with each pulse, allowing for visual monitoring of energy consumption in real time.

*pulse here is a small and fixed amount of energy passing through the meter.

Pulse Rate is a common metric found on such meters [Unit imp/kWh].

✏️ Example: 3200 imp/kWh would indicate that for every kilowatt-hour (kWh) of electricity consumed, the meter will produce 3200 pulses (impulses).

πŸ₯… Goal: Write a program to calculate the total energy consumed in kWh given number of pulses and the imp/kWh of a meter.

πŸ–Ό Example photo of such a meter here.

πŸ“… Submissions: Sunday Morning, 2:00 LT

πŸͺ Send your submissions in the comments.

@WeeklyCoder | Week 31
πŸ‘¨β€πŸ’»1
πŸ”‚ Recursion Time

Let's do this math together. It's simple, add the digits in the numbers:
- 456381901
- 342999002
- 304072023

If you added the digits of each and the obtained result's digits iteratively until you get just a single digit, you'll notice the sums are: 1, 2, and 3 respectively.

Eg: 4567295

4+5+6+7+2+9+5 = 38
3+8 = 11
1+1= 2

Here's the neat thing. If you removed all 9's and all numbers that add up to 9, the sum of the digits will remain the same.

Eg: 4567295

Remove 9
Remove 4 & 5 because 4+5= 9
Remove 7 & 2 because 7+2=9
That leaves: 6 and 5

6+5 = 11
1+1 = 2

πŸ₯… Goal: Write a program to calculate the sum of each digit within a given integer iteratively/recursively until the sum of the resulting sum itself is a single digit.

✏️ Recommend Learning:
- Recursion

⚑ Bring the thunder:
- Remove numbers adding up to 9 and all 9's from the number before adding and see where that takes you.

πŸ“… Submissions: Sunday Morning, 2:00 LT

πŸͺ Send your submissions in the comments.

@WeeklyCoder | Week 32
πŸ‘¨β€πŸ’»1