0% found this document useful (0 votes)
19 views6 pages

Beginner's Guide to Python Programming

Uploaded by

ponnijoseph49
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)
19 views6 pages

Beginner's Guide to Python Programming

Uploaded by

ponnijoseph49
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

Step-by-step Python guide (for complete beginners)

1) Quick decision: how do you want to run Python?

- **Install locally** (Windows/macOS/Linux) — best if you plan to keep learning and build projects.
- **On your phone** — use Pydroid 3 (easy) or Termux (power user).
- **Online REPL** (no install) — try Replit, Trinket or the interactive shell on [Link] to practice
instantly.

---

2) Install Python (pick your platform)

Windows

1. Download the latest Python 3 installer from [Link] and run it.
2. **Important:** check “Add Python to PATH” before Install.
3. Open Command Prompt and verify:
```
py --version

or
python --version
```

macOS

- Option A (easy): download the macOS installer from [Link] and run it.
- Option B (Homebrew users):
```
brew install python
python3 --version
```
Linux (Ubuntu/Debian)

```
sudo apt update
sudo apt install python3 python3-pip -y
python3 --version
```

(For Fedora use `sudo dnf install python3`.)

Android

- Easy: install **Pydroid 3** from Google Play.


- Power: install **Termux**, then inside Termux: `pkg install python`.

Online (no install)

- Use an online REPL such as Replit or the interactive shell on [Link] — you can run code
immediately in the browser.

---

3) Pick an editor / IDE

- **Beginners:** Thonny (simple), IDLE (comes with Python).


- **General:** VS Code (install Python extension).
- **Data science:** Jupyter Notebook / JupyterLab.
- **Phone:** Pydroid 3 editor.

---

4) First program — “Hello, world!”

Create a file called `[Link]` with:


```
print("Hello, world!")
```

Run it in terminal:
```
python [Link]
python3 [Link]
py [Link]
```

Or open REPL/IDLE and type: `print("Hello, world!")`

---

5) Core concepts & tiny examples

**Variables and types**


```
name = "Valan"
age = 20
height = 5.6
is_student = True
```

**Input / output**
```
name = input("Your name: ")
print(f"Hello, {name}!")
```

**Lists and dictionaries**


```
fruits = ["apple", "banana", "mango"]
person = {"name": "Asha", "age": 25}
print(fruits[0])
print(person["name"])
```

---

6) Control flow: conditions & loops

**If / elif / else**


```
n = int(input("Number: "))
if n < 0:
print("Negative")
elif n == 0:
print("Zero")
else:
print("Positive")
```

**For loop**
```
for i in range(5):
print(i)
```

**While loop**
```
count = 0
while count < 5:
print(count)
count += 1
```

---

7) Functions

```
def greet(name):
return f"Hello, {name}!"

print(greet("Valan"))
```

---

8) Modules, packages and pip

Install extra packages:


```
pip install requests
pip3 install requests
```

Create isolated environment:


```
python -m venv venv

activate:

Windows:
venv\Scripts\activate

macOS / Linux:
source venv/bin/activate
```

---

9) File I/O and exceptions

```
with open("[Link]", "w") as f:
[Link]("hello\n")

with open("[Link]") as f:
text = [Link]()
print(text)

try:
x = int("abc")
except ValueError:
print("That wasn't a number!")
```

---

10) Practical beginner projects

1. Guess the Number


2. Simple calculator
3. To-Do list CLI
4. Text analyzer
5. Mini quiz

---

11) Helpful commands cheat-sheet

```
python [Link]
python3 [Link]
py [Link]

python --version
pip --version

pip install package_name

python -m venv venv


source venv/bin/activate
venv\Scripts\activate
```

---

12) Short practice exercises

1. Program that asks for a name and prints Hello.


2. Loop that prints even numbers 2–20.
3. Function is_palindrome(s).

---

13) Where to go next

- Data: NumPy, pandas, matplotlib.


- Web: Flask, Django.
- Automation: requests, bs4, selenium.
- Apps/Games: tkinter, pygame.
- Testing: pytest.

Book: Automate the Boring Stuff with Python.

You might also like