0% found this document useful (0 votes)
1 views3 pages

01 Python For Beginners

Python for Beginners — variables, control flow, functions

Uploaded by

Mied Mied
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views3 pages

01 Python For Beginners

Python for Beginners — variables, control flow, functions

Uploaded by

Mied Mied
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python for Beginners

A Gentle Introduction to Programming with Python

A beginner-friendly practical guide


1. What Is Python?
Python is a high-level, general-purpose programming language known for its clean, readable syntax.
It is one of the most popular languages in the world and is used in web development, data analysis,
automation, artificial intelligence, and scientific computing. Because the code reads almost like plain
English, Python is widely recommended as a first programming language.

• Readable: indentation-based structure makes code easy to follow.

• Versatile: one language for web, data, scripting, and machine learning.

• Huge ecosystem: hundreds of thousands of ready-to-use libraries.

• Beginner-friendly: you can be productive within a few hours.

2. Your First Program


The traditional first program prints a short message to the screen. In Python it is a single line:

print("Hello, world!")

Run it by saving the line in a file called [Link] and typing python [Link] in your terminal.

3. Variables and Data Types


A variable is a name that points to a value. Python figures out the type automatically, so you do not
declare it explicitly.

name = "Alice" # string (text)


age = 30 # integer (whole number)
height = 1.72 # float (decimal)
is_student = True # boolean (True or False)

Common built-in types


• str — text, written in quotes.

• int and float — whole and decimal numbers.

• list — an ordered, changeable collection: [1, 2, 3].

• dict — key/value pairs: {"name": "Alice"}.

4. Control Flow
Programs make decisions with if statements and repeat work with loops.

temperature = 18

Python for Beginners Page 2


if temperature > 25:
print("It is hot")
elif temperature > 15:
print("It is mild")
else:
print("It is cold")

for i in range(3):
print("Count:", i)

5. Functions
Functions let you package logic so you can reuse it. Define one with the def keyword.

def greet(person):
return "Hello, " + person + "!"

message = greet("Bob")
print(message) # Hello, Bob!

6. Where to Go Next
Once you are comfortable with the basics, try a small project: a number-guessing game, a to-do list
saved to a file, or a script that renames photos. Building something real is the fastest way to learn.
Explore the standard library and, when ready, popular packages such as requests for the web or
pandas for data.

Python for Beginners Page 3

You might also like