PythonSkills.org
Courses
Exercices
Challenges
Quizzes
Open console
0 points
Get started
Loading...
Archives:_
Introduction to Python : Welcome to the world of Python programming! Python is one of the most popular and easy-to-learn programming languages. Whether you want to build a web...
Introduction to variables : In Python, variables are used to store information that your program can manipulate and use later. Think of a variable as a box that holds data, like ...
The input() function : The input() function in Python is used to take user input from the console. It allows you to interact with the user by prompting them to enter data, w...
The print() Function : Once we understand variables, it’s important to see how we can display the values they store. This is where the print() function comes in. The print()...
Introduction to Numbers : Numbers are the fundamental building blocks for any computations in Python, and understanding how they work is essential. In Python, numbers come...
Working with Integers : In Python, integers (represented by the int data type) are whole numbers, including positive, negative, and zero. Unlike some other programming langua...
Exploring floating numbers : 1. Representing decimal numbers in PythonUnlike integers, floats (short for floating-point numbers) are used to represent decimal numbers in Python. E...
Complex numbers : Complex numbers are a special data type in Python represented by the complex class. They extend the concept of numbers beyond real numbers (integers a...
Introduction to Strings : In Python, strings are a fundamental data type used to represent text data. They are essentially sequences of characters that can include letters, num...
String indexing and slicing : 1. Accessing individual characters:Python strings behave like sequences, where each character has a designated position or index. You can access any c...
String concatenation and formatting : 1. Combining strings using the + Operator:The plus operator (+) is the most straightforward way to combine strings. It creates a new string by joining...
String character analysis : Strings are sequences of characters, and analyzing their content is a common programming task. This involves examining the individual characters withi...
String capitalization : Python offers several methods to manipulate the capitalization of characters within a string. You can convert all characters to uppercase using upper(...
Stripping substring : Python provides several methods to remove leading, trailing, or both leading and trailing whitespace from a string. Here are the most common ones:stri...
Substring searching : Substring replacement involves finding a specific sequence of characters (a substring) within a larger string and then replacing it with a different s...
Substring replacement : Substring searching involves finding the occurrence(s) of a specific sequence of characters (a substring) within a larger string. It's a fundamental o...
Introduction to Lists : Imagine a shopping list where you jot down items you need to buy. In Python, lists are similar, they are ordered collections of items that can hold va...
List operations : Let's focuses on manipulating elements within Python lists. 1. Adding elements:append()This method adds an element to the end of the list. It's like p...
List slicing : List slicing is a powerful technique in Python that allows you to extract a sublist (a portion of the list) based on specific starting and ending posi...
List concatenation : Using the + operator, allows you to merge two or more lists into a single new list. It's like combining two shopping lists into one bigger list.Here's...
Common built-in list methods : These are some of the most frequently used built-in methods that operate on lists in Python. Let's explore what each one does:len(list)This method ret...
Working with real-world data: Shopping list : One of the practical applications of Python lists is storing and managing real-world data. Let's see how you can use lists to create a shopping list:1...
Splitting and joining : Joining and splitting are commonly used operations for manipulating strings and lists. 1. Joining a list into a string:Joining is the process of combi...
Introduction to Tuples : Tuples in Python are used to store collections of elements, similar to lists. However, there's a crucial difference: tuples are immutable. This means ...
Working with Tuples : 1. Unpacking Tuples:Unpacking allows you to assign multiple elements from a tuple to individual variables in a single line. The number of variables mu...
Introduction to Sets : Sets are a fundamental data type in Python used to store collections of items. Unlike lists or tuples, sets are unordered. This means the order in whi...
Unordered nature of Sets : The unordered nature of sets in Python means that the elements within a set don't have a defined sequence or position. Unlike lists or tuples, where t...
Creating Sets : 1. Using curly braces {}:This is the most straightforward method for creating a set with specific elements you define. You simply enclose the elements...
Set membership (in operator) : The in operator in Python is used to check if a value exists as a member (element) within a set. It returns True if the value is found in the set, and...
Common Set operations : Set operations allow you to manipulate and combine sets in Python to create new sets based on specific criteria. Here's a breakdown of the four common...
Built-in Set methods : Sets in Python come with various methods that allow you to modify and interact with their elements. Here's a breakdown of some commonly used methods:1...
Introduction to dictionaries : In Python, dictionaries are a fundamental data structure used to store collections of data. Unlike lists or tuples, which store elements in a specific...
Creating Dictionaries : The primary way to create a dictionary is by using curly braces {} and specifying key-value pairs within them:# Example dictionary my_dictionary = { ...
Accessing and modifying elements : 1. Accessing values by key:To retrieve the value associated with a specific key in a dictionary, you use square brackets [] after the dictionary name,...
Common dictionary methods : These are common dictionary methods:get(key, default=None)This method is used to retrieve the value associated with a specific key in a dictionary. It...
Introduction to Flow Control : Flow control refers to the mechanism that determines the order in which instructions in your program are executed. By default, in Python (and most pro...
Conditional statements : 1. The if statement:The if statement is the foundation of conditional statements in Python. It allows you to execute a block of code only if a certain...
The While loop : A while loop is used to repeatedly execute a block of code as long as a given condition is True. The condition is evaluated before each iteration, and...
The For loop : A for loop is used to iterate over a sequence (such as a list, tuple, string, or range) and execute a block of code for each element in that sequence....
Break and continue : In a while loop (or any loop like for), break and continue are control flow statements that affect how the loop operates, but they work in different w...
Looping through a String : Looping through a string in Python means iterating over each character in the string one by one, using a loop. Since a string is a sequence of charact...
Looping through a List : Looping through a list means iterating over each element in the list one by one. This is commonly done using a for loop, which allows you to access an...
Common mistakes to avoid when working with lists : One of the common pitfalls to avoid when working with Python lists is modifying the list while you're iterating over it. This can lead to unexpected r...
Looping through Dictionaries : 1. Looping through Keys:This approach focuses on iterating over all the keys present in the dictionary.Syntax:for key in dictionary_name: # Your ...