If you’ve decided to take the plunge into coding, I’d like to offer my congratulations. Coding is an interesting hobby, a worthwhile skill, and a great foundation for a new career in technology.
One of the more common programming languages for beginners to start with is Python. Here, we’re going to discuss the pros and cons of Python as a first language and offer advice on coding in Python for beginners.
Why Is Python a Good First Programming Language?
Why choose Python to start learning to code? Python is a high-level language with a relatively straightforward syntax, a great community, and a truly vast scope.
Unless you’re a computer scientist or you’re really, really motivated to learn a low-level language like C, working in a high-level language will mean you have to do fewer things like memory management. This basically means you won’t have as many things to keep track of and can focus on writing good, clean code.
Python is also easy for beginners to read and understand. It isn’t quite as readable as Ruby, but it isn’t far off. This is important because coding can be tough for beginners, and it only becomes tougher when you’re dealing with a complicated language whose syntax makes it easy to constantly introduce bugs.
If you want to become a great novelist you have to read a lot of novels, absorbing their style and ideas and blending them into your own unique approach. It’s the same with code. Reading code other people have written is an important part of building your own skill set. Luckily, you don’t have to be very good at Python to read it, but the same thing isn’t true for many other languages.
What Are Good Python Projects for Beginners?
I’m a firm believer in getting your hands dirty from the very beginning. Coding is a living skill, it’s something that you can only get so good at with books, courses, and Youtube videos. Becoming a good coder requires spending lots of time coding.
So you should focus from the outset on building things that you want to build. Shelly Tan at Knight Lab offers a fun list of projects that you can start tinkering with on day one:
- Dice Roll Simulator: Build a simple script that rolls an imaginary die and prints out the number that came up. Working with random numbers and print statements is as good a place to start as any.
- Number Guessing Game: Write code that picks a random number and requires the user to guess it. The code should compare the user’s guess to the real number and print out an indication of whether the guess is too high or too low. This will require you to further expand your knowledge into user inputs and conditional statements, both great things to learn about.
- Mad Lib Generator: This script will get a series of inputs from the user and place them into a story template before printing out the results. You’ll have to learn a lot about string manipulation to make this work, including concatenation and maybe even ‘f strings’.
- Text Adventure Game: ‘Adventure’ is something a cult classic in the genre of text-based gaming. Building a super simple version of it will flex the muscles required to think about overall program structure and how information flows through code. You’ll need to think carefully about how to build ‘rooms’ that a user can go into, how to use conditionals to make multiple scenarios, and how to track variable state.
- Hangman: We all remember the classic children’s game ‘Hangman’, but as a coding project it’s surprisingly sophisticated. You’ll need to have a hidden word, get user-inputted guesses, compare those guesses to the letters in the word, put a limit on how many guesses can be made, and myriad other tasks. You probably use software everyday that has exactly this kind of functionality built into it, and now you get to learn how it’s done!
You could pick and choose from this list or do them in any order, but this is actually a pretty nifty micro-curriculum for learning to code in Python.
Hopefully this will be a fun way to jumpstart your career as a developer.