Better Programming

Advice for programmers.

Follow publication

Member-only story

3 Fun Beginner Python Projects With Random Numbers

Martin Andersson Aaberge
Better Programming
Published in
11 min readMar 8, 2021
Photo of a man holding a Rubik’s cube
Photo by Tima Miroshnichenko from Pexels.

When you start learning Python, it is easy to get lost in variables, lists, sets, if statements, and loops, and not know where to take it next.

The beauty of learning a new programming language is that it allows you to solve problems you weren’t able to solve earlier. You now have a new weapon in your arsenal, but how do you use it?

I’ve used Python to hang pictures on my wall, so I’m living proof that you don’t have to create fake projects. You can use Python in real life to save you some trouble. In fact, I can guarantee you that if certain people in a workplace learned Python, that company could easily save thousands of dollars per year.

A programming language alone won’t solve any problems for you. Your brain has to do that. Figuring out the logic is the hard part. The language is only there to support you.

It is always a good idea to start small projects to get used to problem-solving and thinking about clever solutions. Some projects are easy to grasp, while others can grow and you will regret diving down that rabbit hole. The important part is to learn along the way.

Let’s look at a few projects you can create to better understand how you can use programming to solve problems.

1. Guess the Number

picture of a woman holding her hands in front of the eyes of another older woman
Photo by Andrea Piacquadio from Pexels.

We’ll warm up with a classic guessing game. In this game, the computer will guess a random number and the player will try to guess what number it is.

The game ends when the player manages to guess the number.

First, we need to import randint. Then we need to set the max and min boundaries so we know our range. Min and max can be any two numbers (remember, we chose integers for this game).

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Martin Andersson Aaberge
Martin Andersson Aaberge

Written by Martin Andersson Aaberge

CG supervisor with 20 years of experience in the Animation- and VFX industry. UX, Writing, Programming, Productivity. martinaaberge.collaboration@gmail.com

Responses (3)

Write a response