Online courses are a great place to learn the foundations of code. But it's when you put things into practice that you cement the concepts into your brain.
Figuring out how to solve problems and conquer coding challenges can be truly rewarding (and fun!). Stephanie, a Software Developer from Baltimore, shares why practice (including code challenges) is key to mastering a programming language:
"Codecademy is a great starting point for learning different programming languages and introducing concepts, but there's only so much you can cover in a course. A good chunk of mastering a language is learning through experience."
1. Print all even numbers from 0 – 10
Try to make the solution to this problem as efficiently as possible. Consider using loops that would allow you to type the fewest characters/commands. While you could simply print the even numbers, get creative and see how you could output them in a way that would work up to 10 or even up to 10,000 with little extra effort.
2. Print a table containing multiplication tables
Let's start with the tables that many of us had to memorize in school. Can you print a table that contains all the answers to the multiplication tables from 1 through 10?
Like Challenge #1, can you create an efficient solution that you could easily expand should you need the 12 times table?
3. Create a length converter function
Creating a function is a skill that'll be useful in many settings, and as you progress, you'll be working on much more complicated functions than this one. But a function that converts units of measure can be pretty handy in multiple professions and industries.
Let's start with a conversion from kilometers to miles. The function should include the input in kilometers and return the answer in miles.
4. Calculate the sum of numbers within an array
You can create your own array of numbers but consider trying this problem with a few different sets to verify your solution. Have one array with negative and positive numbers and another with integers and decimals.
You could also try using arrays of different lengths. If you're feeling comfortable with this, try the slightly more challenging bonus challenge below.
Bonus intermediate challenge: Create a function that can return the sum of a particular column or row number in a table.
5. Create a function that reverses an array
This challenge is particularly helpful if you're planning to become a Data Scientist. Manipulating data is a significant part of the role, and building the foundations now will help you later down the road when you're working with large databases.
Start small here and work your way up. Begin with an array of 5 numbers, and then try your program with a larger array to verify its success.
6. Sort an array from lowest to highest
You could create a function for this solution as well, but be sure to try your program with varying lengths and types of arrays. Try one with all integers, another with negative numbers, and another with decimals.
7. Create a function that filters out negative numbers
In this challenge, you'll have a function that takes an array as an input and returns an array. But if all goes according to plan, it'll remove the negative numbers. This is another example of a task that'll be useful when combing through data and looking for clever ways to eliminate "bad data."
8. Remove the spaces found in a string
Yet another way to clean up data is to remove any errors or unnecessary spaces. This function will take in a string and then return it with all spaces removed. Think about if you were tasked with cleaning up customer data at your job. You could scale this function to clean up specific fields of data, such as zip codes.
9. Return a Boolean if a number is divisible by 10
Here, you'll create a function that'll give you a "true" or "false" Boolean as its output. The inputted number should only return a "true" if it's divisible by 10. Otherwise, your program should return a "false" answer.
10. Return the number of vowels in a string