Python Tutorial
Learn Python with Ngahtech
Python is a versatile and powerful programming language that's popular for web development, data analysis, artificial intelligence, scientific computing, and more. This comprehensive tutorial will guide you from Python basics to advanced topics.
At Ngahtech, we provide clear explanations and practical examples to help you master Python programming.
Start Learning Python NowLearning by Examples
With our interactive approach, you can learn Python by editing code and seeing the results immediately.
# This is a simple Python program
print("Hello, World!")
print("Welcome to Ngahtech Python Tutorial")
# Variables and operations
x = 5
y = 3
sum = x + y
print(f"The sum of {x} and {y} is {sum}")
Click the "Try it Yourself" button to edit the code and see how it works.
Python Topics Overview
Python Basics
Learn Python syntax, variables, data types, operators, and basic programming concepts to build a strong foundation.
Start LearningData Structures
Master lists, tuples, sets, dictionaries, arrays, and other essential data structures in Python.
Explore Data StructuresControl Flow
Understand if-else statements, loops (while and for), match statements, and control structures.
Learn Control FlowFunctions & Modules
Create reusable functions, work with modules, understand scope, and organize your code efficiently.
Study FunctionsObject-Oriented Programming
Learn classes, objects, inheritance, polymorphism, encapsulation, and other OOP concepts.
Master OOPFile Handling
Read, write, create, and delete files in Python. Work with different file formats and handle exceptions.
Handle FilesPython Exercises
Test your knowledge with exercises at the end of each chapter. Get instant feedback and track your progress.
Exercise: Variables and Data Types
What is the correct way to declare a Python variable?
# Option 1
var name = "John"
# Option 2
name = "John"
# Option 3
name: "John"
# Option 4
string name = "John"
Track Your Progress
Create a Ngahtech account to track your learning progress, save your code, and earn achievements.
Current progress: 65% complete
Create Free AccountPython Reference
Comprehensive reference for Python built-in functions, string methods, list methods, dictionary methods, and more.
Python Built-in Functions
Complete reference of all Python built-in functions with examples and usage.
View ReferenceList Methods
Complete guide to Python list methods for manipulating and working with lists.
Learn MorePython Database Handling
Learn how to work with databases in Python including MySQL and MongoDB.
Python MongoDB
Work with MongoDB, a NoSQL database, using Python for modern applications.
Explore MongoDBAdvanced Topics
Explore advanced Python topics including machine learning, data science, and web development.
Machine Learning
Introduction to machine learning with Python, including libraries like scikit-learn.
Start ML JourneyData Science
Learn data analysis and visualization with Pandas, NumPy, and Matplotlib.
Explore Data ScienceKickstart Your Python Career
Complete our comprehensive Python course and get certified to boost your career opportunities.
Get CertifiedPython Introduction
Python is a high-level, interpreted programming language known for its simplicity and readability. Created by Guido van Rossum and first released in 1991, Python has become one of the most popular programming languages worldwide.
Python is used in various domains including web development, data science, artificial intelligence, scientific computing, automation, and more.
Python Syntax
Python syntax is designed to be readable and straightforward. Unlike many other programming languages, Python uses indentation to define code blocks instead of curly braces.
# Python uses indentation to define blocks
if 5 > 2:
print("Five is greater than two!")
# This would cause an error
# if 5 > 2:
# print("Five is greater than two!")
Python Variables
Variables are containers for storing data values. In Python, you don't need to declare the type of variable explicitly. Python determines the type automatically based on the value assigned.
# Variable assignment
x = 5
y = "Hello, World!"
# Multiple assignment
a, b, c = 1, 2, 3
# Check variable type
print(type(x)) # <class 'int'>
print(type(y)) # <class 'str'>