Writing Your First Program
•
1 minute read
Programming Learning Journey
Part 3 of 3
Development Environment
Before writing our first program, we need to set up the development environment.
Installing Python
- Visit the official website python.org
- Download the latest version
- Install the program with “Add to PATH” option enabled
Code Editor
I recommend using VS Code:
- Free and open source
- Diverse extensions
- Excellent support for multiple languages
First Program
Hello World
# Our first program
print("Hello World!")
print("I'm learning programming")
Interactive Program
# Request user name
name = input("What's your name? ")
print(f"Hi {name}! Welcome to the world of programming")
Simple Calculator
# Simple calculator
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
print(f"Sum: {num1 + num2}")
print(f"Difference: {num1 - num2}")
print(f"Multiplication: {num1 * num2}")
print(f"Division: {num1 / num2}")
Exercise
Try writing a program that asks the user for their age and calculates their birth year.
In the Next Part
We’ll learn about variables and data types in detail.