PYnative

Practice Coding

  • Python â–¼
    • Python Tutorials
    • Python Basics
    • Python Interview Q&As
  • Coding Exercises â–¼
    • Python Exercises
    • C++ Exercises
    • C Programming Exercises
    • Java Exercises
    • C# Exercises
  • MCQsâ–¼
    • Python MCQ Quizzes
    • Java MCQ Quizzes
    • C++ MCQ Quizzes
  • Compilersâ–¼
    • Online Python Compiler
    • Online C Compiler
    • Online C++ Compiler
    • Online Java Compiler
    • Online C# Compiler
Home » Python » Python Lists

Python Lists

Updated on: November 30, 2026 | 40 Comments

A Python list is an ordered, changeable sequence of items. It is one of the most commonly used data structures in Python.

In this tutorial, you’ll learn how to create a list, access its items, and add, modify, and remove items. You’ll also learn how to iterate, sort, copy, and search lists, and how to use nested lists and list comprehensions, with examples.

Also See:

  • Python List Exercise
  • Python List Quiz
  • Summary of List Operations
Python List
Python List

A list has the following properties:

  • Mutable: You can change, add, or remove items after the list is created.
  • Ordered: Items keep the order in which you add them, and each item has an index position. New items are added at the end by default.
  • Heterogeneous: A list can hold items of different types, such as strings, integers, booleans, or even other lists.
  • Allows duplicates: A list can contain the same value more than once.
  • Dynamic: A list grows and shrinks automatically as you add or remove items.

Why use a list?

  • Lists are very flexible and come with many built-in methods, such as append(), pop(), and sort(), which make it easy to work with data that keeps changing.
  • Because lists are mutable, they are a good choice when the values in a collection change frequently.
  • They can store any mix of values, including duplicates, while keeping them in order.

Table of contents

  • Creating a Python list
  • Length of a list
  • Accessing items of a list
    • Indexing
    • Negative indexing
    • List slicing
  • Iterating a list
    • Iterate along with an index number
  • Adding elements to the list
    • Append item at the end of the list
    • Add item at the specified position in the list
    • Using extend()
  • Modify the items of a list
    • Modify all items
  • Removing elements from a list
    • Remove a specific item
      • Remove all occurrences of a specific item
    • Remove the item at a given index
    • Remove a range of items
    • Remove all items
  • Finding an element in the list
  • Concatenation of two lists
  • Copying a list
    • Using the assignment operator (=)
    • Using the copy() method
    • Deep copy
  • List operations
    • Sort a list using sort()
    • Reverse a list using reverse()
  • Python built-in functions with lists
    • Using max() & min()
    • Using sum()
    • all()
    • any()
  • Nested list
  • List comprehension
  • Common mistakes with lists
  • Summary of list operations

Creating a Python list

You can create a list in two ways:

  • Using square brackets ([]): Write the items inside square brackets, separated by commas. This is the most common way.
  • Using the list() constructor: Pass any iterable, such as a tuple, string, or range(), to list(), and it builds a list from its items.
# Using square brackets
my_list1 = [1, 2, 3]
print(my_list1)
# Output [1, 2, 3]

# Using the list() constructor with a tuple
my_list2 = list((1, 2, 3))
print(my_list2)
# Output [1, 2, 3]

# with heterogeneous items
my_list3 = [1.0, 'Jessa', 3]
print(my_list3)
# Output [1.0, 'Jessa', 3]

# from a string and a range
print(list("abc"))     # ['a', 'b', 'c']
print(list(range(5)))  # [0, 1, 2, 3, 4]

# empty list using list()
my_list4 = list()
print(my_list4)
# Output []

# empty list using []
my_list5 = []
print(my_list5)
# Output []Code language: Python (python)

Length of a list

To find the number of items in a list, use the built-in len() function.

my_list = [1, 2, 3]
print(len(my_list))
# Output 3Code language: Python (python)

Accessing items of a list

You can access list items in two ways:

  • Indexing: get a single item using its index number.
  • Slicing: get a range of items.

Indexing

Every item in a list has an index (position number). You can use this index inside square brackets to get the item.

Python positive and negative indexing
Python Positive and Negative indexing

Indexes go from left to right, starting at 0 for the first item and ending at length of the list – 1 for the last. So to get the 3rd item, use index 2.

Note:

  • Valid indexes go from 0 to len(list) - 1.
  • If you use an index that is outside this range, Python raises an IndexError.
  • Indexes must be integers. Using any other type, such as a float or a string, raises a TypeError.

Example

my_list = [10, 20, 'Jessa', 12.50, 'Emma']
# access the 2nd item of the list
print(my_list[1])  # 20
# access the 5th item of the list
print(my_list[4])  # EmmaCode language: Python (python)

We accessed the second item using index 1 and the fifth item using index 4.

Negative indexing

You can also access items from right to left using negative indexes. The last item has index -1, the second-to-last has -2, and so on down to -len(list) for the first item.

my_list = [10, 20, 'Jessa', 12.50, 'Emma']
# access the last item of the list
print(my_list[-1])
# Output Emma

# access the second-to-last item of the list
print(my_list[-2])
# Output 12.5

# access the 4th item from the end
print(my_list[-4])
# Output 20Code language: Python (python)

List slicing

Slicing lets you get a range of items from a list as a new list. For example, you can get the items from position 3 to 7. You can also use slicing to change a range of items at once.

The syntax for list slicing is:

list_name[start_index : end_index : step]Code language: Python (python)
  • start_index is the position where the slice begins (included). If omitted, it defaults to 0.
  • end_index is the position where the slice stops (not included). If omitted, the slice goes to the end of the list.
  • step lets you take every nth item in the range. The default is 1. A negative step goes backward.

Example

my_list = [10, 20, 'Jessa', 12.50, 'Emma', 25, 50]
# items from index 2 up to (not including) index 5
print(my_list[2:5])
# Output ['Jessa', 12.5, 'Emma']Code language: Python (python)

Let’s see a few more slicing examples:

  • Extract the first part of a list
  • Slice with a step
  • Reverse a list
  • Slice without an end position

Example

my_list = [5, 8, 'Tom', 7.50, 'Emma']

# slice the first four items
print(my_list[:4])
# Output [5, 8, 'Tom', 7.5]

# every second item (step 2)
print(my_list[::2])
# Output [5, 'Tom', 'Emma']

# reverse the list
print(my_list[::-1])
# Output ['Emma', 7.5, 'Tom', 8, 5]

# without end_index: from index 3 to the last item
print(my_list[3:])
# Output [7.5, 'Emma']Code language: Python (python)

Iterating a list

You can go through the items of a list one by one using a for loop.

my_list = [5, 8, 'Tom', 7.50, 'Emma']

# iterate a list
for item in my_list:
    print(item)Code language: Python (python)

Output

5
8
Tom
7.5
Emma

Iterate along with an index number

When you need both the index and the value, the easiest way is the built-in enumerate() function. In each iteration, it gives you the index and the item together.

fruits = ["apple", "banana", "cherry"]
for i, fruit in enumerate(fruits):
    print(i, fruit)Code language: Python (python)

Output

0 apple
1 banana
2 cherry

You can also loop over the index numbers with range() and len(). Since indexes go from 0 to len(list) - 1, range(len(my_list)) produces exactly the indexes you need.

Example

my_list = [5, 8, 'Tom', 7.50, 'Emma']

# iterate a list using index numbers
for i in range(len(my_list)):
    # print each item using its index number
    print(my_list[i])Code language: Python (python)

Output

5
8
Tom
7.5
Emma

Adding elements to the list

You can add a new item, or several items, to a list using the methods append(), insert(), and extend().

Append item at the end of the list

The append() method takes exactly one argument and adds it to the end of the list.

Let’s add the item ‘Emma’ to the end of the list.

my_list = [5, 8, 'Tom', 7.50]

# Using append()
my_list.append('Emma')
print(my_list)
# Output [5, 8, 'Tom', 7.5, 'Emma']

# append a nested list at the end
my_list.append([25, 50, 75])
print(my_list)
# Output [5, 8, 'Tom', 7.5, 'Emma', [25, 50, 75]]Code language: Python (python)

Notice that appending a list adds it as a single item (a nested list). To add each item separately, use extend().

Add item at the specified position in the list

Use the insert() method to add an item at a specific position. It takes two arguments: the index and the item.

list_name.insert(index, item)Code language: Python (python)

It inserts the item before the current item at index, shifting the rest to the right.

my_list = [5, 8, 'Tom', 7.50]

# Using insert()
# insert 25 at position 2
my_list.insert(2, 25)
print(my_list)
# Output [5, 8, 25, 'Tom', 7.5]

# insert a nested list at position 3
my_list.insert(3, [25, 50, 75])
print(my_list)
# Output [5, 8, 25, [25, 50, 75], 'Tom', 7.5]Code language: Python (python)

As you can see, item 25 was added at index position 2.

Using extend()

The extend() method takes an iterable (such as another list) and adds each of its items to the end of the list.

Let’s add three items to the end of the list.

my_list = [5, 8, 'Tom', 7.50]

# Using extend()
my_list.extend([25, 75, 100])
print(my_list)
# Output [5, 8, 'Tom', 7.5, 25, 75, 100]Code language: Python (python)

We added three integers at once. They are added in the same order they were passed, at the end of the list.

Modify the items of a list

Lists are mutable, so you can change their items. Use the index number and the assignment operator (=) to give an item a new value.

Let’s see two scenarios:

  • Modify a single item
  • Modify a range of items
my_list = [2, 4, 6, 8, 10, 12]

# modify a single item
my_list[0] = 20
print(my_list)
# Output [20, 4, 6, 8, 10, 12]

# modify a range of items
# from index 1 up to (not including) index 4
my_list[1:4] = [40, 60, 80]
print(my_list)
# Output [20, 40, 60, 80, 10, 12]

# modify from index 3 to the end
my_list[3:] = [80, 100, 120]
print(my_list)
# Output [20, 40, 60, 80, 100, 120]Code language: Python (python)

Modify all items

Use a for loop with the index to modify every item in place. Let’s replace each item with its square.

my_list = [2, 4, 6, 8]

# change the value of all items
for i in range(len(my_list)):
    # calculate the square of each number
    my_list[i] = my_list[i] * my_list[i]

print(my_list)
# Output [4, 16, 36, 64]Code language: Python (python)

Alternatively, build a new list with a list comprehension: my_list = [x * x for x in my_list].

Removing elements from a list

You can remove items from a list using the following methods and statements.

MethodDescription
remove(item)Removes the first occurrence of the item from the list.
pop(index)Removes and returns the item at the given index. Without an index, it removes the last item.
clear()Removes all items, leaving an empty list.
del list_name[index]Deletes the item at an index, or a slice of items.
del list_nameDeletes the entire list variable.
Python List methods to remove items

Remove a specific item

Use the remove() method to remove the first occurrence of an item from the list.

Note: It raises a ValueError if the item is not present in the list.

Example

my_list = [2, 4, 6, 8, 10, 12]

# remove item 6
my_list.remove(6)
# remove item 8
my_list.remove(8)

print(my_list)
# Output [2, 4, 10, 12]Code language: Python (python)

Remove all occurrences of a specific item

Since remove() deletes only the first match, you need a different approach to remove every occurrence. The clearest way is a list comprehension that keeps all the other items:

my_list = [6, 4, 6, 6, 8, 12]

# keep every item that is not 6
my_list = [item for item in my_list if item != 6]
print(my_list)
# Output [4, 8, 12]

# or: keep removing while the item is still in the list
my_list = [6, 4, 6, 6, 8, 12]
while 6 in my_list:
    my_list.remove(6)
print(my_list)
# Output [4, 8, 12]Code language: Python (python)

Warning: Don’t call remove() inside a for loop that iterates over the same list. Removing items shifts the remaining ones, so the loop can skip items and give wrong results.

Remove the item at a given index

Use the pop() method to remove the item at a given index. pop() also returns the removed item, so you can use it.

Note: If you don’t pass an index, pop() removes the last item in the list.

Example

my_list = [2, 4, 6, 8, 10, 12]

# remove the item at index 2
removed = my_list.pop(2)
print(removed)  # 6
print(my_list)
# Output [2, 4, 8, 10, 12]

# remove the last item (no index)
my_list.pop()
print(my_list)
# Output [2, 4, 8, 10]Code language: Python (python)

Remove a range of items

Use the del keyword with slicing to remove a range of items.

my_list = [2, 4, 6, 8, 10, 12]

# remove items from index 2 up to (not including) index 5
del my_list[2:5]
print(my_list)
# Output [2, 4, 12]

# remove all items starting from index 3
my_list = [2, 4, 6, 8, 10, 12]
del my_list[3:]
print(my_list)
# Output [2, 4, 6]Code language: Python (python)

Remove all items

Use the list’s clear() method to remove all items. The list still exists, but it is empty. To delete the list variable itself, use del.

my_list = [2, 4, 6, 8, 10, 12]

# clear the list
my_list.clear()
print(my_list)
# Output []

# delete the entire list
del my_listCode language: Python (python)

Finding an element in the list

To check whether an item exists in a list, use the in operator. To get the position of an item, use the index() method. To count how many times an item appears, use count().

index() returns the index of the first occurrence of the item, or raises a ValueError if the item doesn’t exist.

my_list = [2, 4, 6, 8, 10, 12, 8]

print(8 in my_list)        # True
print(100 in my_list)      # False
print(my_list.index(8))    # 3
print(my_list.count(8))    # 2

# raises ValueError because 100 is not in the list
# my_list.index(100)Code language: Python (python)

Tip: Check with in before calling index() to avoid the error.

Concatenation of two lists

Concatenating two lists means joining them together. There are two ways to do that:

  • The + operator creates a new list that contains the items of both lists.
  • The extend() method adds the items of the second list to the end of the existing first list.

You can also repeat a list with the * operator, for example, [0] * 3 gives [0, 0, 0].

Example

my_list1 = [1, 2, 3]
my_list2 = [4, 5, 6]

# Using the + operator
my_list3 = my_list1 + my_list2
print(my_list3)
# Output [1, 2, 3, 4, 5, 6]

# Using the extend() method
my_list1.extend(my_list2)
print(my_list1)
# Output [1, 2, 3, 4, 5, 6]Code language: Python (python)

Copying a list

Copying a list is a common source of bugs, because the assignment operator doesn’t actually make a copy. Let’s compare the options.

Using the assignment operator (=)

When you write new_list = my_list1, Python does not create a new list. Both names refer to the same list object, so any change made through one name is visible through the other.

my_list1 = [1, 2, 3]

# Using the = operator
new_list = my_list1
print(new_list)
# Output [1, 2, 3]

# make a change in the original list
my_list1.append(4)

# print both names
print(my_list1)
# Output [1, 2, 3, 4]
print(new_list)
# Output [1, 2, 3, 4]Code language: Python (python)

As you can see, the change to the original list also shows up in new_list, because they are the same list. So don’t use the assignment operator when you need an independent copy. Use the copy() method instead.

Using the copy() method

The copy() method creates a new list with the same items. Changes to the original list (such as adding or removing items) don’t affect the copy. This is called a shallow copy. You can also make a shallow copy with my_list[:] or list(my_list).

my_list1 = [1, 2, 3]

# Using the copy() method
new_list = my_list1.copy()
print(new_list)
# Output [1, 2, 3]

# make a change in the original list
my_list1.append(4)

# print both lists
print(my_list1)
# Output [1, 2, 3, 4]
print(new_list)
# Output [1, 2, 3]Code language: Python (python)

This time, the change to the original list is not reflected in the copy.

Deep copy

A shallow copy creates a new outer list, but any nested lists inside it are still shared. If your list contains other lists, use copy.deepcopy() to copy everything, including the nested lists.

import copy

a = [[1, 2], [3, 4]]
shallow = a.copy()
shallow[0].append(99)
print(a)        # [[1, 2, 99], [3, 4]]  (the inner list is shared!)

a = [[1, 2], [3, 4]]
deep = copy.deepcopy(a)
deep[0].append(99)
print(a)        # [[1, 2], [3, 4]]  (unchanged)
print(deep)     # [[1, 2, 99], [3, 4]]Code language: Python (python)

List operations

Lists have built-in methods for common operations such as sorting and reversing.

Sort a list using sort()

The sort() method sorts the items of the list in place, in ascending order by default.

my_list = [3, 2, 1]
my_list.sort()
print(my_list)Code language: Python (python)

Output

[1, 2, 3]

Useful options and alternatives:

  • sort(reverse=True) sorts in descending order.
  • sort(key=len) sorts by a custom rule, here by the length of each item.
  • The built-in sorted() function returns a new sorted list and leaves the original unchanged.
nums = [3, 1, 2]
print(sorted(nums))  # [1, 2, 3]
print(nums)          # [3, 1, 2] (unchanged)

nums.sort(reverse=True)
print(nums)          # [3, 2, 1]

words = ["banana", "kiwi", "apple"]
print(sorted(words, key=len))  # ['kiwi', 'apple', 'banana']Code language: Python (python)

Reverse a list using reverse()

The reverse() method reverses the order of the items in place.

my_list = [3, 4, 5, 6, 1]
my_list.reverse()
print(my_list)Code language: Python (python)

Output

[1, 6, 5, 4, 3]

The items are now in reverse order. Note that reverse() doesn’t sort the list. It only flips the current order.

Python built-in functions with lists

Besides the list’s own methods, you can use many of Python’s built-in functions on lists. Let’s look at a few of them.

Using max() & min()

The max() function returns the largest value in the list, and min() returns the smallest.

my_list = [3, 4, 5, 6, 1]
print(max(my_list))  # returns the largest number in the list
print(min(my_list))  # returns the smallest number in the listCode language: Python (python)

Output

6
1

Using sum()

The sum() function returns the total of all the numbers in the list.

my_list = [3, 4, 5, 6, 1]
print(sum(my_list))Code language: Python (python)

Output

19

all()

The all() function returns True only when every item in the list is true (or the list is empty). Here are the possible cases:

Item values in listReturn value
All values are trueTrue
One or more false valuesFalse
All values are falseFalse
Empty listTrue
# with all true values
sample_list1 = [1, 1, True]
print("all() All True values:", all(sample_list1))

# with one false value
sample_list2 = [0, 1, True, 1]
print("all() with One false value:", all(sample_list2))

# with all false values
sample_list3 = [0, 0, False]
print("all() with all false values:", all(sample_list3))

# empty list
sample_list4 = []
print("all() Empty list:", all(sample_list4))Code language: Python (python)

Output

all() All True values: True
all() with One false value: False
all() with all false values: False
all() Empty list: True

any()

The any() function returns True if at least one item in the list is true. For an empty list, it returns False.

Item values in listReturn value
All values are trueTrue
One or more false valuesTrue
All values are falseFalse
Empty listFalse

Let’s see each of these cases with a small example.

# with all true values
sample_list1 = [1, 1, True]
print("any() True values:", any(sample_list1))

# with one false value
sample_list2 = [0, 1, True, 1]
print("any() One false value:", any(sample_list2))

# with all false values
sample_list3 = [0, 0, False]
print("any() all false values:", any(sample_list3))

# empty list
sample_list4 = []
print("any() Empty list:", any(sample_list4))Code language: Python (python)

Output

any() True values: True
any() One false value: True
any() all false values: False
any() Empty list: False

Nested list

A list can contain other lists (sub-lists), which can contain more lists, and so on. This is called a nested list.

my_list = [3, 4, 5, 6, 3, [1, 2, 3], 4]Code language: Python (python)

To access an item of an inner list, use two indexes: the first selects the inner list, and the second selects the item inside it. To go through all the items of the inner lists, use a nested for loop.

nested_list = [[2, 4, 6, 8, 10], [1, 3, 5, 7, 9]]

print("Accessing the third element of the second list", nested_list[1][2])
for inner in nested_list:
    print("list", inner, "elements")
    for item in inner:
        print(item)Code language: Python (python)

Output

Accessing the third element of the second list 5
list [2, 4, 6, 8, 10] elements
2
4
6
8
10
list [1, 3, 5, 7, 9] elements
1
3
5
7
9

In nested_list[1][2], the first index (1) selects the second inner list, and the second index (2) selects its third item.

List comprehension

A list comprehension is a short, readable way to create a new list from an existing iterable. It can also filter the items, keeping only those that satisfy a condition.

new_list = [expression for item in iterable if condition]Code language: Python (python)
  • expression: Required. Computes each item of the new list, for example, item ** 2.
  • item: Required. A variable that takes each value from the iterable in turn.
  • iterable: Required. The input sequence, such as a list or range().
  • if condition: Optional. Keeps only the items for which the condition is true.
input_list = [4, 7, 11, 13, 18, 20]
# create a list of squares of only the even numbers
square_list = [var ** 2 for var in input_list if var % 2 == 0]
print(square_list)Code language: Python (python)

Output

[16, 324, 400]

We created a new list from an existing list in a single statement. It contains only the squares of the even numbers from the input list.

The input can also be a range of numbers:

# create a list of squares of even numbers in a range
square_list1 = [s ** 2 for s in range(10) if s % 2 == 0]
print(square_list1)Code language: Python (python)

Output

[0, 4, 16, 36, 64]

Common mistakes with lists

  • Expecting = to copy a list: It only creates another name for the same list. Use copy() or copy.deepcopy().
  • Assigning the result of sort(): sort(), append(), and reverse() change the list in place and return None. Writing my_list = my_list.sort() leaves you with None. Use sorted() if you need a new list.
  • Removing items while looping over the list: This skips items. Build a new list with a comprehension instead.
  • Creating a 2D list with *: [[0] * 3] * 3 creates three references to the same inner list, so changing one row changes them all. Use [[0] * 3 for _ in range(3)] instead.
  • Index out of range: The last valid index is len(list) - 1. Use my_list[-1] to get the last item safely.
# wrong: all rows share one inner list
grid = [[0] * 3] * 3
grid[0][0] = 1
print(grid)  # [[1, 0, 0], [1, 0, 0], [1, 0, 0]]

# right: each row is a separate list
grid = [[0] * 3 for _ in range(3)]
grid[0][0] = 1
print(grid)  # [[1, 0, 0], [0, 0, 0], [0, 0, 0]]Code language: Python (python)

Summary of list operations

For the following examples, assume that l1 and l2 are lists and x, i, j, and k are integers.

l1 = [10, 20, 30, 40, 50] and l2 = [60, 70, 80, 60]

OperationDescription
x in l1Check if the list l1 contains item x.
x not in l2Check if the list l2 does not contain item x.
l1 + l2Concatenate the lists l1 and l2. Creates a new list containing the items of both.
l1 * 5Repeat the list l1 5 times.
l1[i]Get the item at index i. For example, l1[2] is 30.
l1[i:j]List slicing. Get the items from index i up to index j (excluding j) as a list. For example, l1[0:2] is [10, 20].
l1[i:j:k]List slicing with a step. Returns the items from index i up to index j, taking every k-th item. For example, l1[0:4:2] is [10, 30].
len(l1)Returns the total number of items in the list. Here, 5.
l2.count(60)Returns the number of times an item (60) appears in the list. The answer is 2.
l1.index(30)Returns the index of the first occurrence of an item (30). The answer is 2.
l1.index(30, 2, 5)Returns the index of an item (30), searching only from index 2 up to index 5. The answer is 2.
min(l1)Returns the item with the smallest value. The answer is 10.
max(l1)Returns the item with the largest value. The answer is 50.
sum(l1)Returns the total of all items. The answer is 150.
l1.append(100)Add an item at the end of the list.
l1.append([2, 5, 7])Append a nested list at the end.
l1.extend([2, 5, 7])Add each item of another list at the end.
l1.insert(1, 15)Insert item 15 at index 1.
l1[2] = 40Modify the item at index 2.
l1.remove(40)Remove the first occurrence of item 40 from the list.
l1.pop(2)Remove and return the item at index 2.
l1.clear()Make the list empty.
l1.sort() / sorted(l1)Sort the list in place / return a new sorted list.
l1.reverse()Reverse the list in place.
l3 = l1.copy()Create a shallow copy of l1 in l3.
Summary of Python List Operations

Filed Under: Python, Python Basics

Did you find this page helpful? Let others know about it. Sharing helps me continue to create free Python resources.

TweetF  sharein  shareP  Pin

About Vishal

I’m Vishal Hule, the Founder of PYnative.com. As a Python developer, I enjoy assisting students, developers, and learners. Follow me on Twitter.

Related Tutorial Topics:

Python Python Basics

All Coding Exercises:

C Exercises
C++ Exercises
Python Exercises
Java Exercises
C# Exercises

Python Exercises and Quizzes

Free coding exercises and quizzes cover Python basics, data structure, data analytics, and more.

  • 15+ Topic-specific Exercises and Quizzes
  • Each Exercise contains 25+ questions
  • Each Quiz contains 25 MCQ
Exercises
Quizzes
In: Python Python Basics
TweetF  sharein  shareP  Pin

  Python Tutorials

  • Get Started with Python
  • Python Statements
  • Python Comments
  • Python Keywords
  • Python Variables
  • Python Operators
  • Python Data Types
  • Python Casting
  • Python Control Flow statements
  • Python For Loop
  • Python While Loop
  • Python Break and Continue
  • Python Nested Loops
  • Python Input and Output
  • Python range function
  • Check user input is String or Number
  • Accept List as a input from user
  • Python Numbers
  • Python Lists
  • Python Tuples
  • Python Sets
  • Python Dictionaries
  • Python Functions
  • Python Modules
  • Python isinstance()
  • Python OOP
  • Python Inheritance
  • Python Exceptions
  • Python Exercise for Beginners
  • Python Quiz for Beginners

 Explore Python

  • Python Tutorials
  • Python Exercises
  • Python Quizzes
  • Python Interview Q&A
  • Python Programs

All Python Topics

  • Python Basics
  • Python Exercises
  • Python Quizzes
  • Python File Handling
  • Python Date and Time
  • Python OOP
  • Python Random
  • Python Regex
  • Python Pandas
  • Python Databases
  • Python MySQL
  • Python PostgreSQL
  • Python SQLite
  • Python JSON

About PYnative

PYnative.com is a platform built to help developers learn by doing. Solve coding exercises, take MCQs, and run code directly in built-in online compilers.

Follow Us

To get New Python Tutorials, Exercises, and Quizzes

  • Twitter
  • Facebook
  • Sitemap

Explore Python

  • Learn Python
  • Python Basics
  • Python Databases
  • Python Exercises
  • Python Quizzes
  • Online Python Code Editor
  • Python Tricks

Coding Exercises

  • C Exercises
  • C++ Exercises
  • Python Exercises
  • Java Exercises
  • C# Exercises

MCQ Quizzes

  • Python MCQs
  • Java MCQs
  • C++ MCQs

Legal Stuff

  • About Us
  • Contact Us

We use cookies to improve your experience. While using PYnative, you agree to have read and accepted our:

  • Terms Of Use
  • Privacy Policy
  • Cookie Policy

Copyright © 2018–2026 pynative.com