[Guide] Intro to Python – Writing Your First Program

Owen C137

Administrator
Staff
Owen C137 Rep
1
0
0
Rep
1
Owen C137 Vouches
1
0
0
Vouches
1
Posts
179
Likes
68
5 YEARS
5 YEARS OF SERVICE
LEVEL 5 225 XP
Intro to Python – Writing Your First Program


Python is one of the most popular programming languages in the world. It’s simple to learn, beginner-friendly, and used in everything from web development to artificial intelligence.

In this tutorial, we’ll install Python, write your first program, and run it.

1. What is Python?​

  • Python is a versatile, high-level programming language.
  • It’s known for its easy-to-read syntax.
  • It can be used for web apps, data analysis, games, automation, and more.

2. Installing Python​

  1. Go to the official website: Download Python.
  2. Choose the latest version for your operating system (Windows, Mac, or Linux).
  3. During installation on Windows, tick the box that says **"Add Python to PATH"**.

3. Writing Your First Python Program​

Open a text editor (like Notepad, VS Code, or Sublime Text) and paste this:

Python:
print("Hello, World!")

  • Save the file as hello.py (make sure the extension is `.py`).
  • Open a terminal/command prompt.
  • Navigate to the folder where you saved the file.
  • Run:
    Code:
    python hello.py

You should see:
Code:
Hello, World!

4. How This Works​

  • print() is a built-in function that outputs text to the screen.
  • Anything inside the quotation marks will be displayed.
  • Every Python program starts with simple statements like this.

5. Doing More with Python​

Here’s an example with variables and user input:

Python:
name = input("What is your name? ")
print("Hello, " + name + "!")

  • input() asks the user for information.
  • We store it in the variable `name` and then print it back.

6. Next Steps​

Now that you can run Python programs:
  • Learn about variables, loops, and conditions.
  • Experiment with simple math:
    Python:
    print(2 + 3)
  • Check out the official Python tutorial for more.



Congratulations! You’ve just written and run your first Python program. This is the first step into the world of programming — keep experimenting and building new things!
 

99

373

461

17

Top