Photo by JetBrains

Print(“Hello World”), How To Be On Your Way To Becoming A Python Programmer.

Michael Rozenvasser

--

Its easier than you think.

“The secret of getting ahead is getting started. The secret of getting started is breaking your complex overwhelming tasks into small manageable tasks, and starting on the first one.” — Mark Twain.

Everytime I’ve picked up Python I dropped it just as quick, because I never actually got to the point of writing any code. For years my dream was always to sit in a coffee a shop with my large headset on and furiously type thousands of lines of code while other patrons looked at my screen with awe. But I never came close to that point because it was always too difficult for me to start.

I always thought you needed a fancy application to start coding, but in reality all you really need to write a program is a text editor and a compiler. Code is usually just plain text. Really, you could write any program imaginable using Windows Notepad and a command-line C compiler.

Code in a command line. Picture from codeontime.com

But in todays time this is not how modern programmers work. To become a successful Python programmer you need to download Python with an IDE(Integrated Developement Environment). Downloading Python allows for the software to be on your computer and lets your computer recognize that the words your typing is code and not just words, while the IDE is where the coding actually takes place. We wont venture too far off into why an IDE is important, becuase that is not the focus of this article, but keep in mind in the long run your going to want to use an IDE becuase it will make like 100x easier. If you read through that and understood the inner works of how Python works, great and if not do not stress, to truly understand the inner workings you have to work through it yourself(a common theme in programming).

Lets put all the gibberish aside and lets get right into coding! We wont have to deal with downloading separate applications and softwares and then making sure they are interacting with each other. Thonny IDE is the easiest way for any programmer to write their first Python program. It comes packaged with Python in it, so you don’t have to go through the steps of downloading Python and an IDE seperately.

Follow the following steps to run Python on your computer.

  1. Download Thonny IDE at https://thonny.org.
  2. Run the installer to install Thonny on your computer.
  3. Go to: File > New. Then save the file with .py extension. For example, hello.py, first_program.py, etc.
    You can give any name to the file. However, the file name should end with .py
  4. Write Python code in the file and save it.
  5. Done!

So lets try out the process ourselves and see if the code actually works.

Hello World! Our first program!

Tada! We did it! It was that easy, we executed our first line of code. In the Shell at the bottom of the screen we can see that our program ran successfully and gave us an output of “Hello World”, exactly what we wanted. All we did was download Thonny and get to typing, two simple steps. Lets try another program and make it interactive.

Say hello.

Nice, now we got our second program running. This program allows us to type our name into the shell and it says hi back to us. Very cool. Now although these are rather simple programs they are nontheless some of the most important becuase it is your first introduction to the world of Python. And soon enough we can start creating simple games that are fun to play.

Guessing my number game.

This simple programs is letting Python pick a random number between 1 and 20 and then we have to guess it. Although this may seem intimidating to you at first, do not worry as this will all come with practice.

Once you start you can’t stop and you shouldn’t. There is so much to learn and projects to complete, it is important to keep some philosophies to code by. My top 3:

  1. ) Practice, Practice, Practice. Consistency is the most important factor to your success when learning Python. Start with 30 minutes per day and by the time you know it a few hours will have flown by where you forgot to eat and use the restroom.
  2. Take the notes! I dislike taking notes just as much as the next person, but notes are a critical component to understanding how the code works on and off the computer. Some interviews will ask to code on a whiteboard, so you truly have to be aware of how the code functions.
  3. Build something, Anything at all! This tip is just as important as the first one. It is imperative that you go out and explore Python on your own. What you build is not as important as how you build it. You will run it bugs and moments where you want to rip out your hair, but it is all part of the process of becoming the best coder you can be. The problems that you solve by building will teach you the most.

Your future steps would be learning about data structures (lists, tuples, and dictionaries), loops, if/else statements, strings, file operations, and exceptions. With those, you can write a large number of programs without having to worry about more advanced topics like object-oriented programming, databases, web design, etc. But, that is all in the future and we are still getting our feet wet. So take the time to write out programs yourself and feel that sense of accomplishment when the code executes, we are well on our way to coding the next BookFace.

--

--