What is the first program about?

In this section, we will write our very first Python program.

What is the first program about?

Learning to code is a lot like learning a new spoken language. When you learn a new language, one of the first words you learn are greetings like Hola, Hello, Ni Hao, or Namaste!

So for our first program, we will make the computer display a greeting on the screen.

  1. Type the following piece of code in the Trinket code editor.
print('hello world')
  1. After typing, click the Run button on the top bar to see the output of your program.
  2. You should see hello world printed in the output box.

See the video below on how to do all the above steps.  

Now, it’s your turn. Please type the code in the Trinket box below and run it!

Do not copy-paste; It’s much more fun to type your program. Try it!

Trinket will help you auto-complete the parentheses ( ) and single quotes ‘. But if you need help in locating or fixing them, click here.

  1. Press and hold the shift key with one finger, and press 9 with another finger while still holding the shift key to type ( and to type ) do the same thing but press 0 instead of 9.
  1. Make sure that the opening and closing quotes and parentheses match.
  2. Make sure there are no spaces in front of the print.

If you see hello world in the output window, then congratulations!! You just coded your very first Python program.

This program may not look all that fancy-schmancy, but this is an important milestone in your coding journey.

I don’t see hello world in the output window after clicking Run. Instead, I see an Error. 🙁

Awesome!! You, my friend, are one step ahead in the course already. Congratulations!!

Click here for tips to fix your error.

What you see? What you do?
SyntaxError: EOF in multi-line statement on line 2 ^ in main.py Check for missing parentheses at the end.
SyntaxError: bad input on line 1 in main.py1. Check for space before print.
2. Missing parentheses or quote at the start.
SyntaxError: bad token on line 1 in main.py. 1. Missing quote at the end.
2. Quote mismatch (using double quotes instead of a single quote).
NameError: name ‘prnt’ is not defined on line 1 in main.pyCheck the spelling of command print
NameError: name ‘Print’ is not defined on line 1 in main.pyMake sure ‘p’ is lowercase in print
IndentationError: unexpected indentMake sure there is no space before print.
No error or output is printedMake sure you have print function before the parentheses.
Error is not listed aboveEmail us your error and keep calm. We got you covered!

Don’t fret if the error message did not make any sense. We will come back to it in the upcoming lessons. 

CLICK ON ‘MARK COMPLETE’ or ‘NEXT TOPIC’ at the top of the page to proceed.