Skip to main content

41 docs tagged with "Python"

View all tags

Combining Loops and Conditionals

Following our exploration of break and continue, this article delves into combining loops and conditionals. This concept is essential for building complex logic and is a foundational element in modern Python development.

Comments and Docstrings

Following our exploration of Basic Console Input and Output, this article focuses on how to make your code more readable and understandable using comments and docstrings.

Common Built-in Functions: len(), type(), range(), etc.

Following our exploration of Operator Precedence and Associativity, this article introduces some of Python's most common and useful built-in functions. These functions are always available to you, without the need to import any modules.

Common Collection Methods and Best Practices

Over the last several articles, we've explored Python's powerful built-in collection types: lists, tuples, dictionaries, and sets, as well as the specialized containers in the collections module. This article serves as a capstone, summarizing the best practices and helping you decide which collection to use in different scenarios.

Conditional Statements: if (Part 1)

Following our exploration of Common Built-in Functions, this article introduces a fundamental concept in programming: conditional statements. We'll start with the most basic conditional statement, the if statement.

Conditional Statements: if-elif-else (Part 3)

Following our exploration of Conditional Statements: if-else (Part 2), this article introduces the if-elif-else statement, which allows you to check multiple conditions in a sequence.

Conditional Statements: if-else (Part 2)

Following our exploration of Conditional Statements: if (Part 1), this article delves into the if-else statement, which allows you to execute a different block of code when the if condition is not met.

Core Concepts: Interpreted Language and Dynamic Typing

Following our exploration of The "What" and "Why" of Python (Part 2), this article delves into two fundamental concepts that define how Python works: its nature as an interpreted language and its use of dynamic typing. Understanding these concepts is key to writing effective Python code.

Fundamental Data Types: Numbers (Integers, Floating-Point)

Following our exploration of Variables and Assignment, this article dives into one of the most fundamental data types in Python: numbers. We'll cover integers and floating-point numbers, and the common operations you can perform on them.

Fundamental Data Types: Strings (Part 1)

Following our exploration of Fundamental Data Types strings. We'll cover how to create strings, use f-strings for formatting, and some of the most common string methods.

Fundamental Data Types: Strings (Part 2)

Following our exploration of Fundamental Data Types: Strings (Part 1), this article delves deeper into the world of strings, covering indexing, slicing, and more advanced string methods.

Introduction to Python Collections Module: namedtuple, deque, Counter

We've now mastered Python's four core collection types. But what happens when you need a more specialized tool? The collections module in Python's standard library provides high-performance, specialized container datatypes. In this article, we'll introduce three of the most useful: namedtuple, deque, and Counter.

Lists (Part 1): Introduction to lists, declaring and initializing lists

Following our exploration of combining loops and conditionals, this article kicks off a new series on Working with Collections, starting with an introduction to Python lists. This concept is essential for storing and manipulating groups of data and is a foundational element in modern Python development.

Lists (Part 2): List methods, slicing, and list comprehensions

Following our introduction to declaring and initializing lists, this article dives deeper into manipulating them. We'll explore the powerful tools Python provides: list methods, slicing, and list comprehensions. Mastering these is key to effectively working with data in Python.

Loop Control: break and continue

Following our exploration of foreach loops, this article delves into break and continue statements. These concepts are essential for writing efficient and readable Python code and are a foundational element in modern Python development.

Loops: for loops (Part 1)

Following our exploration of Conditional Statements, this article introduces another fundamental concept in programming: loops. We'll start with the for loop, which allows you to iterate over a sequence of elements.

Loops: for loops (Part 2)

Following our exploration of Loops: for loops (Part 1), this article delves deeper into the world of for loops, covering nested loops and more advanced patterns for iterating over different data structures.

Loops: foreach loops (iterating over collections)

Following our exploration of Loops: while and do-while loops, this article focuses on what is often called a "foreach" loop in other languages. In Python, this is simply the standard for loop used to iterate over collections.

Loops: while and do-while loops

Following our exploration of Loops the while loop. We'll also see how to simulate a do-while loop, which is not a native feature of Python.

Operators: Comparison Operators (==, !=, <, >, <=, >=)

Following our exploration of Operators: Arithmetic Operators, this article dives into the world of comparison operators in Python. These operators allow you to compare two values and get a boolean result (True or False).

Python Z2H

Welcome! This interactive online book is your comprehensive guide to mastering the Python programming language. Whether you are a complete novice taking your first steps into the world of code or a developer looking to solidify your Python skills, this resource is crafted for you.

Sets: Unordered collections of unique items. Set operations.

We've explored ordered collections like lists and **tuples**, and the key-value world of dictionaries. Now we introduce the final core collection type: the set. Sets are all about uniqueness and are modeled after the mathematical concept of a set.

Ternary Operator

Following our exploration of Conditional Statements the ternary operator.

The What and Why of Python (Part 1)

Welcome to the beginning of your Python journey! This first article dives into the fundamental questions: What is Python, and why has it become one of the most popular programming languages in the world? We'll explore its core philosophy, its fascinating history, and the diverse use cases that make it such a versatile tool for developers.

The What and Why of Python (Part 2)

Following our exploration of The "What" and "Why" of Python (Part 1), this article delves into Python's role in modern software development. We'll explore why Python is the go-to language for web development, data science, machine learning, and automation.

Tuples: Immutable lists, creating and using tuples

After mastering the flexibility of lists in Part 1 and Part 2, we now turn to their close relative they are immutable. Understanding this distinction is key to writing robust and efficient Python code.

Type Conversion (Casting)

Following our exploration of Fundamental Data Types: Booleans (True, False), this article covers type conversion, also known as casting. We'll learn how to convert variables from one data type to another.

Understanding None

Following our exploration of Type Conversion (Casting), this article delves into a special and important value in Python: None. We'll learn what None represents, how to use it, and how to check for it.

Variables and Assignment

Following our exploration of Your First Python Script variables. We'll learn how to create and use variables in Python, and the best practices for naming them.

Your First Python Script: "Hello, World!" (Part 1)

Following our exploration of Setting Up Your Development Environment (Part 2): Configuring Your IDE and Virtual Environments, it's time to write and run your very first Python script. In this article, we'll cover the classic "Hello, World!" program and how to run it from the command line.