My 5 Beginner Programming Projects
Dylan | May 01, 2019
"For the things we have to learn before we can do them, we learn by doing them." -Aristotle
I’m a firm believer in getting a general idea of the basics and immediately diving in deep. "Coding" isn’t just following a tutorial, it’s solving real problems! In fact, before nimblecoding.com, I had never worked on a web project!
Too often, we feel it’s necessary to become walking encyclopedias before being able to apply or teach others what we have learned. We keep thinking that someday we’ll finally get around to that massive Python book collecting dust on the shelf. We think reading the book cover to cover, all 1,200 pages will equip us with everything we need to know to bring any project to life through code. Thankfully, learning doesn’t quite work this way!
Imagine the sheer boredom of mulling over hundreds of pages and taking detailed notes before applying anything. Perhaps no one would become a developer!
How I Got StartedWhen I first began learning Python, I read the first few chapters of the beginner-friendly book, Python Crash Course by Eric Matthes, and immediately saught high-interest areas to apply what I had learned. Eric Matthes does a fantastic job of cutting complex topics into bite-size beginner snacks.
After completing the first half of Python Crash Course, I had a solid enough foundation to begin learning through projects that interested me. In this post, I’ll be sharing the first 5 beginner projects I did on my own.
I’ll be working on providing walk-throughs and tutorials for some of the projects over the next few weeks so keep an eye out for them! Although I began with Python, please feel free to tackle any of my project ideas in whichever language you’re interested in! Without further ado:
Number Guessing GameThis one is simple, playable in a command prompt, and requires the implementation of several basic programming elements.
The general idea behind the game is to have the computer generate a random number. The player then must attempt to guess the random number. If the player’s guess is larger than the random number, the program prints “Too high, guess a lower number: ” and prompts the player for another guess. If the guess is too low, the program prints “Too low, guess a higher number: “ and prompts the player for another guess.
This continues until the player finally guesses the correct number. The program should then print the player’s score (number of guesses made) along with the option to play again or quit. Like golf, in this game the lower the score, the better.
If you’re a beginner, give this game a shot! If you get stuck or want to compare your game to mine, you can check out my walk-through for coding this game in Python here!
Countdown TimerAlthough the command prompt will easily suffix, this is a great project to begin learning how to put together a GUI. Although generally straight forward, the user should be prompted to enter in a time. The timer then begins counting down until the remaining time hits zero and the timer alerts the user with a beeping or ringing sound.
This project contains several interesting problems to tackle as a beginner. Check out my step by step tutorial making a Pomodoro timer with Pygame here!
English to Spanish TranslatorAt first, this project sounds quite intimidating but if you love languages like me, a high-interest challenge can completely captivate you. The depth of this project is limitless and in a serious attempt at machine translation, would eventually dive into machine learning but for a beginner project, you just try to hard-code some hard and fast grammar rules.
I began by assembling a .txt file with the 200 most common words in English alongside their Spanish translations. I found the words on a website and wrote a simple script to scrape and store them in the .txt file.
Begin by programming your translator to build a literal word by word translation using your basic 200-word .txt lexicon. Once a word by word translation is established, you can begin drastically improving your translator’s accuracy.
Some examples of improvements I made are: reversing the order of nouns and their connected adjectives (black cat -> gato negro), matching the gender and count of adjectives to their corresponding nouns, incorporating basic conjugation rules based on the type of verb ending and pronoun. I also used English verbs ending in -ed to mark past tense.
This was the first project where I implemented classes. Different parts of speech mapped nicely into distinct classes, each with unique and specific behaviors.
This project is in no way efficient and has severe scalability issues; however, after some time, my script began producing fairly decent basic machine translations and I certainly learned a lot!
Sudoku Solver (Pygame)Manually entering a Sudoku Puzzle line by line in a console or Python file is far from user-friendly so I decided to incorporate the popular library, Pygame. With Pygame I was able to make a basic GUI that allowed the user to click each box in a Soduku board and assign a number to that slot. Once the board had been fully entered, the user could click a “Solve” button below and my algorithm would attempt to solve the puzzle.
I went with a brute-force approach and had the program try each number in every box. If a number violated the rules of Sudoku, it would increment to the next number. If every number violated the rules of Sudoku, the program would return to the previous box and increment its number by one. The program would return all the way back to the very first box if no possible combinations existed.
This project helped me grasp multidimensional arrays and looping over them. It was also an interesting algorithm to ponder and provided my first opportunity to use recursion.
Tic Tac Toe (Pygame)I used Pygame once again for this classic game. Initially, my design was for two people to play one another on one machine, each alternating turns. On a player’s turn, clicking on a square would cause their mark to appear in that square. After each turn, the program had to check over the board for a win or tie.
Eventually, I decided to upgrade the game and make a bot to play against. It took me a bit but after coding my bot to run all future scenarios and prioritize avoiding defeat and choosing the move with the most possible future wins, my bot eventually became unbeatable. It turns out this bot isn’t actually fun to play against.
Whether you’re interested in giving one of my first projects a shot or considering what projects interest you, get out there and give it a shot! The truth is that only a small percentage of my programming knowledge has come from studying a book or following a tutorial. The vast majority of my knowledge comes from trying new things out! I’m sure you can come up with better solutions to these projects than I did!
As always, make sure you let us know what you think in the comments below. Everyone’s interested to hear about your first programming projects. Let us know about the first projects you worked on and maybe I’ll have to give them a shot!