top of page

Hello world...Again

  • hkerr961
  • Jul 8, 2023
  • 5 min read

Updated: Aug 6, 2023

Hello, world!


Two words that hold more significance than you might think; especially when it comes to computer programming. The phrase has been around since the early days of programming when it was used as an example of how a program could produce or print out a string of text in A Tutorial Introduction to the Language B by Brian Kernighan in 1972.


“Hello, World!” has become widely used as an introduction to coding, with many textbooks, tutorials and teachers traditionally using it to begin any adventure into learning how to code. I remember a simple “Hello, World!” program being the first code I ever wrote on the very first day of my “Introduction to Computer Science” course in college. It’s an unofficial rite of passage, or “welcome to the club” if you will, into the development community and the best place to start our journey here.


It also feels like the perfect way to introduce myself. My name’s Hannah, and I am, or was, a software engineer. My journey with software engineering started in my freshman year of college. Through a series of accidents, I ended up in an Introduction to Computer Science class my freshman year and things clicked pretty quickly. I loved the puzzle solving aspect of computer programming; being faced with a problem and working through a thought process to solve it and then translating that solution into code. Fast forward a few years and I graduated with a degree in computer science and spent two years working as a software engineer, working on projects ranging from cloud, web, and embedded server development.


For a variety of reasons, I decided to take a bit of a career break and leave my company to explore other possibilities. A two year career gap has taken me around the globe and opened my eyes to places, experiences, and opportunities that I never would have imagined.


When I left my old job, I had vowed that I never wanted to write another line of code again. Now, did that come from a burnt-out, overwhelmed, and slightly jaded place? …maybe… Ok, most definitely. But time heals all wounds and though I’ve discovered I don’t want to return to software development in the same way I was working in before, I still have an excitement for technology, programming, and puzzle solving; and I don’t think I’m done with coding quite yet.


Enter this project - a multipurpose mission to reconnect with development myself, share some knowledge in a simple, accessible way and, hopefully, get a few people engaged with and excited about software development.


Towards that goal, I believe that a “Hello, world” program is the most appropriate way to kick things off.


I’m going to be using Python in this demo, because not only is it a pretty powerful language, it’s also very intuitive, making it perfectly beginner friendly and all level accessible. I’m also using a Windows 10 operating system because that’s what laptop I have. The windows vs. mac debate is one people have strong opinions on and one that I’m not going to be touching with a 10ft pole. If you have mac, bear in mind that some of the command line prompts and computer setup may be different, but the actual code will remain the same


So whether you’re a seasoned pro developer or a first timer, let's get into it.


Downloading and Installing Python


To start things off, we need to be able to run a python program and for that we’ll have to download python. Do that by going to the official python website and selecting the latest download for your operating system. At the time of writing, the latest release is Python 3.11.4



After it’s downloaded, run the executable by double clicking on it. Make sure to select the box “Add python to path” and click Install Now.




When the install is finished it will display a successful dialog.




To check that python has been installed and is good to go, open a command terminal and run the following command:

python --version

If this is all new and you're thinking "what is a command terminal??", think of it as a written back door to your computer where you can pass notes and instructions back and forth. A command line interface is a way to control your computer through text commands rather than using the GUI (graphical user interface - AKA the screen displays and all the buttons you clickity clack).


To open a command terminal type 'Command Prompt' into the windows search bar and open a window.


'python - -version' is basically just asking your computer “what version of python is installed”. If all went well with the install, the terminal should print out the version of Python we just installed.



Write the program


Now that we have python all set up, we have to write the hello world program. A computer program is, boiled down, a set of instructions and actions written in code for the computers processing system to execute. When we get into developing larger programs and projects, we’ll want to set up an IDE (integrated development environment). There are many IDEs out there that make organizing, writing, editing, running and testing code a breeze; check out another article walking you through setting up a development environment here. But for today’s purpose, a simple python file will do.


Navigate to a folder where you want to store your code.


To do this through the command prompt, you have to know the path to get to the folder you want to work in. The command terminal will open by default to the user's root path, from here you can traverse down the folders like they are tree branches with the change directory ('cd') command. For example, if you want to create your program in your Documents folder, you would navigate your command prompt into Documents with the command:

 cd Documents

If all that sounds like too much right now, no worries, stay tuned for another article explaining computer paths and command terminals in more detail. Instead, use file explorer to get to the folder you want to work in, select the address bar, type "cmd" and press enter, that will open a new command prompt at this path location.


Use the command "notepad helloWorld.py", shown below, to create a new python file. We’re using notepad as a basic text editor here since it should be installed by default on all windows computers, if you have a preferred one, feel free to use it instead.

This will open up a blank file in notepad, within it write the following code:

def main():
	print("Hello world!")

main()

And that's it!


Since we’re keeping things basic here, all this does is define and run a main function, which prints out the phrase “Hello world!”. When this python program is run, the main function will be called and the phrase will be printed out in the terminal window.


Go ahead and give it a go.


Congratulations! You’ve written your very first computer program! *highfive*


From me to you and the dev community, hello world…again.

Comments


© 2035 by Hannah Kerr. Powered and secured by Wix

  • LinkedIn
  • GitHub
bottom of page