JetBrains Academy
The place for learning and teaching computer science your way
Learn in 1 Hour: Object-Oriented Programming in Python
It’s the second day in the series of blog posts about what you can do in just an hour at JetBrains Academy! We decided to dedicate the next four days to the intricacies of particular programming languages, starting with Python. If you’ve missed an hour of linear algebra yesterday, see Learn in 1 Hour: Introduction to Linear Algebra.
There are many ways to go about writing code, and that’s one of the reasons a lot of people love Python — it supports multiple programming paradigms (or styles of coding), allowing developers to choose whichever one they prefer. Nevertheless, one of the most commonly used paradigms today is object-oriented programming.
Object-oriented programming (OOP) is based on the concept of classes and objects. This paradigm allows developers to create a clear program structure and make their code easier to maintain, debug, and reuse. OOP (if done right) can make very difficult coding problems easy to solve and rearrange large software projects into manageable parts.
If you are new to OOP, just one hour of studying will help you get a quick grasp on all the basic concepts without feeling overwhelmed:
🕐 Introduction to OOP
🕐 Class
🕐 Class instance
And if you are already familiar with OOP or want to practice the theory you’ve just learned, check out our interactive projects! Smart Calculator is a great choice for your first OOP project! Here, you will create a calculator app, which will perform different mathematical operations, use variables, and handle invalid user input. Moreover, you will refresh other Python fundamentals, such as dictionaries, if-else statements, exceptions, and data structures.
If you’d like to try something more advanced, or want to work on a game-based project, we invite you to take a look at Tic-Tac-Toe with AI. With this project, you will teach the computer to play a popular pen-and-paper game and compete against both human users and AI.
You will create a grid for the game, learn to work with it, and implement three difficulty levels: easy, medium, and hard. As a result, you’ll use OOP concepts in your development process, practice using classes and functions, learn to handle errors, and work with user input.
If you like a real challenge, pick Spam Filter! This is a complex project, but the idea behind it is simple: build a program to find and filter spam messages in your inbox. Spam Filter will help you not only practice OOP concepts but also brush up on the most popular data science algorithms. It might take you more than an hour to finish the project, but that satisfactory feeling of achievement afterward is definitely worth it!
How do you enjoy exploring the world of programming in just 1 hour? Share a story about some interesting, challenging, or fun 1-hour experience you’ve had at JetBrains Academy and get a chance to win a 25% discount on your personal subscription at JetBrains Academy. Learn more about the rules in the Hour of Code at JetBrains Academy blog post.
Happy Hour of Code!
Your JetBrains Academy team