🐍 Python Programming Crash Course for Beginners
Title Page
Title: Python Programming Crash Course for Beginners
Author: [Your Name or Institution]
Date: October 2025
Category: Computer Science / Programming Tutorial
Table of Contents
1. Introduction
2. Why Learn Python?
3. Installing and Setting Up Python
4. Your First Python Program
5. Variables and Data Types
6. Control Structures
7. Functions and Modules
8. Working with Lists, Tuples, and Dictionaries
9. File Handling
10. Error Handling
11. Mini Projects for Practice
12. Additional Learning Resources
13. Conclusion
1. Introduction
Python is one of the most popular programming languages in the world. Known for its simplicity and readability, Python
is widely used in data science, web development, automation, and artificial intelligence.
This crash course introduces Python fundamentals through simple explanations and hands-on examples.
2. Why Learn Python?
Python is:
● Beginner-friendly: Its syntax is easy to learn.
● Versatile: Used in web apps, AI, data analysis, and more.
● Powerful: Supported by thousands of libraries (NumPy, Pandas, Flask, etc.).
● In-demand: One of the most sought-after programming skills globally.
3. Installing and Setting Up Python
1. Visit https://www.python.org.
2. Download and install the latest version (ensure “Add Python to PATH” is checked).
1. To confirm installation, open your terminal and type:
python --version
3.
4. Recommended code editors:
○ VS Code
○ PyCharm
○ Jupyter Notebook
4. Your First Python Program
Open your editor and type:
2. print("Hello, World!")
Save as hello.py and run:
3. python hello.py
Output:
4. Hello, World!
🎉 Congratulations — you’ve just written your first Python program!
5. Variables and Data Types
Variables store data values. Python is dynamically typed, meaning you don’t have to declare the type explicitly.
5. name = "Alice" # String
6. age = 25 # Integer
7. height = 5.6 # Float
8. is_student = True # Boolean
You can check data types using:
9. print(type(name))
6. Control Structures
Conditional statements:
10. score = 85
11. if score >= 90:
12. print("Grade A")
13. elif score >= 75:
14. print("Grade B")
15. else:
16. print("Grade C")
Loops:
17. for i in range(5):
18. print(i) # Prints numbers 0–4
19. count = 0
20. while count < 3:
21. print("Counting:", count)
22. count += 1
7. Functions and Modules
Functions help organize reusable code.
23. def greet(name):
24. return f"Hello, {name}!"
25.
26. print(greet("Alice"))
Importing modules:
27. import math
28. print(math.sqrt(16)) # Output: 4.0
8. Working with Lists, Tuples, and Dictionaries
Lists (mutable):
29. fruits = ["apple", "banana", "cherry"]
30. fruits.append("mango")
31. print(fruits)
Tuples (immutable):
32. coordinates = (10, 20)
33. print(coordinates[0])
Dictionaries (key-value pairs):
34. person = {"name": "John", "age": 30}
35. print(person["name"])
9. File Handling
Python can easily read and write files.
Write to a file:
36. with open("data.txt", "w") as f:
37. f.write("This is a test file.")
Read from a file:
38. with open("data.txt", "r") as f:
39. print(f.read())
10. Error Handling
Use try-except blocks to handle runtime errors gracefully.
40. try:
41. x = int(input("Enter a number: "))
42. print(10 / x)
43. except ZeroDivisionError:
44. print("Cannot divide by zero!")
45. except ValueError:
46. print("Please enter a valid number.")
11. Mini Projects for Practice
1. Simple Calculator
47. a = int(input("Enter first number: "))
48. b = int(input("Enter second number: "))
49. print("Sum =", a + b)
2. Word Counter
50. text = input("Enter text: ")
51. words = text.split()
52. print("Word count:", len(words))
3. To-Do List
53. tasks = []
54. while True:
55. task = input("Add task (or 'exit'): ")
56. if task == "exit":
57. break
58. tasks.append(task)
59. print("Your tasks:", tasks)
12. Additional Learning Resources
● Automate the Boring Stuff with Python – Al Sweigart
● Python Crash Course – Eric Matthes
● W3Schools Python Tutorial
● Real Python
● Kaggle Learn: Python
13. Conclusion
Python is one of the best languages to start your programming journey. With simple syntax, powerful libraries, and a
massive community, Python enables you to build projects quickly and confidently.
Keep practicing by solving small problems — every line of code brings you closer to mastery.
60.