🌍 Lesson 1.3: Hello World in Three Languages
Write your very first program — the classic "Hello, World!" — in Python, JavaScript, and C#.
🎯 Learning Objectives
By the end of this lesson, you will be able to:
- Create a new code file in VS Code for each language
- Write a "Hello, World!" program in Python, JavaScript, and C#
- Run each program from the terminal
- Identify the basic syntax differences between the three languages
- Add comments to your code
Estimated Time: 45 minutes
Project: Three working "Hello World" programs you can run
📑 In This Lesson
Why "Hello, World!"?
"Hello, World!" is the traditional first program in almost every programming language. It's been the starting point since the 1970s, and there's a good reason: it's the simplest possible program that produces visible output.
Writing "Hello, World!" tests that your entire setup works: your editor saves the file correctly, your runtime is installed, and your terminal can find and execute the program. If "Hello, World!" works, you're ready to build anything.
Project Setup
Let's create a folder to hold all your course exercises. This keeps your work organized.
- Open VS Code
- Open the built-in terminal: Ctrl + ` (backtick)
- Create a project folder and navigate into it:
# Create a folder for the course (pick a location you'll remember)
mkdir programming-fundamentals
cd programming-fundamentals
# Create a subfolder for this lesson
mkdir lesson-03-hello-world
cd lesson-03-hello-world
Now open this folder in VS Code: File → Open Folder and select lesson-03-hello-world.
✅ Good Habit: One Folder Per Lesson
Creating a separate folder for each lesson keeps your files organized. You'll thank yourself later when you want to find a specific exercise.
🎓 Instructor Note: Delivery Guidance
Walk through folder creation live. Some students may not know how mkdir and cd work — briefly explain that mkdir creates a folder and cd changes into it. If you prefer, students can create the folder using their OS file manager instead. The important thing is that they have VS Code open with a known folder.
🐍 Hello World in Python
Step 1: Create the File
In VS Code, create a new file called hello.py. The .py extension tells VS Code (and Python) that this is a Python file.
Step 2: Write the Code
print("Hello, World!")
That's it. One line. Python's print() function displays text to the terminal. The text inside the quotes is called a string.
Step 3: Run It
In the VS Code terminal, type:
python hello.py
Output:
Hello, World!
💡 What Just Happened?
You told the Python runtime to read hello.py. Python read the single instruction (print("Hello, World!")) and executed it, which displayed the text in your terminal. That's the basic cycle: write → save → run → see output.
⚡ Hello World in JavaScript
Step 1: Create the File
Create a new file called hello.js. The .js extension marks it as JavaScript.
Step 2: Write the Code
console.log("Hello, World!");
JavaScript uses console.log() instead of print(). Notice the semicolon at the end — JavaScript uses semicolons to mark the end of a statement (Python doesn't need them).
Step 3: Run It
In the terminal:
node hello.js
Output:
Hello, World!
⚠️ "console.log" — Why That Name?
JavaScript was designed for web browsers, where output goes to the browser's console (a developer tool). The log() part means "write a log entry." The name stuck even when JavaScript moved to the terminal with Node.js.
🔷 Hello World in C#
C# works a little differently from Python and JavaScript. Instead of just creating a single file, you create a project using the dotnet command.
Step 1: Create a C# Project
In the terminal, run:
dotnet new console -n HelloWorld
This creates a new folder called HelloWorld with a project file and a starter code file.
Step 2: Look at the Code
Open the file HelloWorld/Program.cs in VS Code. You'll see:
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
Modern C# (using "top-level statements") is surprisingly concise! Console.WriteLine() is C#'s version of print().
💡 Console.WriteLine vs Console.Write
Console.WriteLine() prints text and moves to a new line afterward. Console.Write() prints text but stays on the same line. For now, use WriteLine().
Step 3: Run It
Navigate into the project folder and run:
cd HelloWorld
dotnet run
Output:
Hello, World!
📖 Why does C# need a project?
C# is a compiled language. Before your code runs, it's transformed into a more efficient format. The project file (.csproj) tells the compiler how to build your program. Python and JavaScript are interpreted — they run your source code directly.
Side-by-Side Comparison
Now let's see all three together. Click ⊞ All to compare them side by side:
print("Hello, World!")
console.log("Hello, World!");
Console.WriteLine("Hello, World!");
What's the Same?
- All three use a function to display text:
print(),console.log(),Console.WriteLine() - The text is wrapped in quotes (a string)
- The text is placed inside parentheses (function arguments)
What's Different?
| Feature | 🐍 Python | ⚡ JavaScript | 🔷 C# |
|---|---|---|---|
| Print function | print() |
console.log() |
Console.WriteLine() |
| Line ending | Nothing needed | Semicolon ; |
Semicolon ; |
| File extension | .py |
.js |
.cs |
| Run command | python hello.py |
node hello.js |
dotnet run |
| Project required? | No — single file | No — single file | Yes — uses dotnet new |
Exercises
🏋️ Exercise 1: Modify the Message
Objective: Change "Hello, World!" to display your own custom message.
- Open each of your three files (
hello.py,hello.js,HelloWorld/Program.cs) - Change the text inside the quotes to say something else (e.g., your name, a favorite quote)
- Save and run each one to see your new output
✅ Example Solution
print("My name is Alex and I'm learning to code!")
console.log("My name is Alex and I'm learning to code!");
Console.WriteLine("My name is Alex and I'm learning to code!");
🏋️ Exercise 2: Multiple Lines of Output
Objective: Print three separate lines of text in each language.
- Create three new files:
multiline.py,multiline.js, and updateProgram.cs - Write three print/log/writeline statements — one for each line
- Run each and verify you see three lines of output
💡 Hint
Just call the print function three times in a row! Each call on its own line.
✅ Solution
print("Line 1: I'm learning Python!")
print("Line 2: I'm learning JavaScript!")
print("Line 3: I'm learning C#!")
console.log("Line 1: I'm learning Python!");
console.log("Line 2: I'm learning JavaScript!");
console.log("Line 3: I'm learning C#!");
Console.WriteLine("Line 1: I'm learning Python!");
Console.WriteLine("Line 2: I'm learning JavaScript!");
Console.WriteLine("Line 3: I'm learning C#!");
🏋️ Exercise 3: Add Comments
Objective: Add a comment above each print statement explaining what it does.
- Take your code from Exercise 2
- Add a comment above each line using the correct syntax for each language
- Run the program again — the comments should not appear in the output
✅ Solution
# Display first language
print("Line 1: I'm learning Python!")
# Display second language
print("Line 2: I'm learning JavaScript!")
# Display third language
print("Line 3: I'm learning C#!")
// Display first language
console.log("Line 1: I'm learning Python!");
// Display second language
console.log("Line 2: I'm learning JavaScript!");
// Display third language
console.log("Line 3: I'm learning C#!");
// Display first language
Console.WriteLine("Line 1: I'm learning Python!");
// Display second language
Console.WriteLine("Line 2: I'm learning JavaScript!");
// Display third language
Console.WriteLine("Line 3: I'm learning C#!");
🎓 Instructor Note: Delivery Guidance
Exercise 1 is the priority — make sure every student gets at least this one working. It confirms their environment is functional. Exercise 2 reinforces the write-save-run cycle. Exercise 3 introduces commenting, which you'll want students using from day one. If time is short, assign Exercise 3 as homework. For advanced students who finish early, challenge them to print an ASCII art picture using multiple print statements.
Summary
🎉 Key Takeaways
- You wrote and ran your first programs in three languages — that's a real accomplishment!
- The cycle is always: write → save → run → see output
- Python uses
print(), JavaScript usesconsole.log(), C# usesConsole.WriteLine() - JavaScript and C# need semicolons; Python doesn't
- C# requires a project (
dotnet new console); Python and JavaScript run single files - Comments (
#in Python,//in JS/C#) are ignored by the computer — they're notes for humans
🚀 What's Next?
You can now make the computer say anything you want. In the next module, we'll teach it to remember things — with variables. You'll learn how all three languages store and name data.
🎉 Module 1 Complete!
You've set up your tools and written your first programs. The foundation is laid — let's build on it!
🎯 Quick Check
Question 1: Which language requires you to create a project before writing code?
Question 2: What symbol does Python use for single-line comments?
Question 3: Which two languages share the same comment syntax?
Comments in Code
Comments are notes you write in your code that the computer ignores. They're for humans — your future self, your teammates, your instructor. Good comments explain why you did something, not what the code does (the code itself shows what).
Notice that JavaScript and C# share the same comment syntax (
//), while Python uses#. All three also support multi-line comments: