getting started with Python

AlexCoussediere
4 views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

Welcome to the World of Python! 🐍

Python is a powerful, versatile, and beginner-friendly programming language. Whether you want to dive into Web Development, Data Science, or Artificial Intelligence, Python is the perfect starting point.


1. What is Python?

Created by Guido van Rossum and released in 1991, Python is an interpreted, high-level, and general-purpose language. It was designed with one core philosophy in mind: code readability.

Key Advantages:

  • Simple Syntax: Python’s syntax resembles the English language, making it easy to learn and write.
  • Interpreted: Code is executed line-by-line, which makes debugging much faster.
  • Batteries Included: It comes with a vast standard library that allows you to do everything from file manipulation to networking without installing extra tools.
  • Cross-Platform: Python runs on Windows, macOS, and Linux.

2. Setting the Scene: "Hello World"

In many languages, writing a simple message requires several lines of boilerplate code. In Python, it only takes one:

# The classic first step
print("Hello, World!")

3. Core Concepts

A. Variables and Types

Python uses dynamic typing, which means you don't need to declare the type of a variable when you create one. The interpreter automatically detects if it's text, a number, or a logic value.

# Assignment: variable_name = value
name = "Alex"          # String (text)
age = 30               # Integer (whole number)
price = 19.99          # Float (decimal number)
is_learning = True     # Boolean (True/False)

# You can even change the type of a variable later
age = "Thirty"         # Now age is a String

B. Indentation

In Python, indentation is not just for making the code look "pretty" it is a requirement. While other languages (like C++ or Java) use curly braces {} to group code, Python uses spaces.

[Image comparing Python indentation with C-style curly braces]

# Everything indented under the 'if' belongs to that block
if is_learning:
    print("Keep going!")
    print("You are doing great.")
else:
    print("Start learning today!")

# This line is not indented, so it runs regardless of the 'if'
print("End of program.")

Note: Always remember that in Python, spaces at the beginning of a line are part of the logic!

Open Source Your Knowledge: become a Contributor and help others learn. Create New Content