Arrays, Lists, and Strings - Python Programming Exercises

Welcome to Arrays, Lists, and Strings! In this lesson, you will explore three essential data structures in Python programming: arrays, lists, and strings. These structures are fundamental for organizing and manipulating data in your Python programs. You will learn how to create, access, and modify arrays and lists, as well as how to work with strings to store and manipulate text.

  •  Array Reversal

    This Python program prompts the user to input 5 numbers and stores them in an array (or list in Python). After all the numbers are entered, the program displays them ...

  •  Array Lookup

    his Python program asks the user to input a specific number of floating-point numbers and stores them in a list. The program then repeatedly prompts the user to enter...

  •  Even Number Array

    This Python program prompts the user to enter 10 integer numbers and displays only the even numbers from the list. It utilizes a for loop to iterate through th...

  •  Positive and Negative Number Array

    This Python program prompts the user to enter 10 real numbers and calculates two averages: one for the positive numbers and another for the negative numbers...

  •  Numerous Numbers and Their Sum

    This Python program prompts the user to enter several numbers, calculating their sum as they go. The program continues to prompt the user for numbers until they enter...

  •  Matrix Array

    This Python programming exercise is ideal for practicing the handling of multidimensional arrays. In this case, the goal is to prompt the user for the marks of 20 students, ...

  •  Advanced Statistics

    This Python statistical program is a fantastic exercise for improving data handling and user interaction in programming. The program allows users to add new data...

  •  Namedtuple

    This Python program is an excellent introduction to using NamedTuples for storing structured data. The program allows users to define 2D points with specific f...

  •  Array of Namedtuple

    In this exercise, you will develop a Python program that expands the previous exercise (NamedTuple point), allowing up to 1,000 points to be stored using an "array of...

  •  Array of Namedtuple and menu

    In this exercise, you will develop a Python program that expands the previous exercise (array of NamedTuples), so that it displays a menu where the user...

  •  Library Database

    In this exercise, you will develop a Python program to create a small database for storing book data. For each book, you will keep the following information: Title...

  •  Enhanced Triangle V2

    In this exercise, you will develop a Python program that prompts the user for their name and displays a triangle with it, starting with 1 letter and growing until it ...

  •  Enhanced Rectangle V3

    In this exercise, you will develop a Python program that prompts the user for their name and a size, and displays a hollow rectangle with it. This exercise is ...

  •  Symmetrical Triangle

    In this exercise, you will develop a Python program that displays a centered triangle from a string entered by the user. This exercise is perfect for practicin...

  •  Urban Database

    In this exercise, you will develop a Python program to create a database for storing information about urban areas. In the first approach, you will store only the nam...

  •  Display Banner

    In this exercise, you will develop a Python program to mimic the basic Unix SysV "banner" utility, capable of displaying large texts. This exercise is perfect ...

  •  Right-Aligned Triangle

    In this exercise, you will develop a Python program that prompts the user for a string and displays a right-aligned triangle. This exercise is perfect for prac...

  •  Text Processing

    In this exercise, you will develop a Python program that prompts the user for a string and performs several transformations. The program will replace all lowercase 'a...

  •  Hierarchical Structures

    In this exercise, you will develop a Python program to store two pieces of data for a person: Name and Date of birth. The Date of birth must be a...

  •  Data Organization

    In this exercise, you will develop a Python program that prompts the user for 10 integer numbers (ranging from -1000 to 1000), sorts them, and displays them in sorted...

  •  Screen Buffer Using 2D Array

    In this exercise, you will develop a Python program that declares a 70x20 two-dimensional array of characters, "draws" 80 letters (X, for example) in random positions...

  •  2D Array: Display Circle

    In this exercise, you will develop a Python program that creates a 70x20 two-dimensional array of characters, "draws" a circle with a radius of 8 inside it, and displ...

  •  Software Applications

    In this exercise, you will develop a Python program that can store up to 1,000 records of software applications. For each application, you must keep the following dat...

  •  Exercise tasks

    In this exercise, you will develop a Python program that can store up to 2,000 "to-do tasks". For each task, it must keep the following data: Date (a set of 3 ...

  •  Home Finances

    In this exercise, you will develop a Python program that can store up to 10,000 records of expenses and incomes to create a small household accounting system. For eac...

 More Python Programming Exercises Grouped

  •  Your First Steps in Python

    Welcome to Your First Steps in Python! In this first lesson, you will begin your journey with the basics of Python programming. By completing this beginner lesson...

  •  Mastering Flow Control

    Welcome to Mastering Flow Control! In this lesson, you will dive deep into the essential concepts of flow control in Python programming. Through practical exam...

  •  Python Data Types

    Welcome to Python Data Types! In this lesson, you will explore the core data types in Python programming, such as integers, floats, strings, and ...

  •  Mastering Functions

    Welcome to Mastering Functions! In this lesson, you will learn the essential concepts of functions in Python programming. Functions are the building blocks of ...

  •  OOP Object-Oriented Programming

    Welcome to Object-Oriented Programming (OOP)! In this lesson, you will dive into the world of OOP in Python programming. Object-Oriented Programming is ...

  •  Mastering Python Classes in OOP

    Welcome to Mastering Python Classes in OOP! In this lesson, you will learn how to define and use classes in Object-Oriented Programming (OOP) with Python...

  •  Managing Files

    Welcome to Managing Files! In this lesson, you will learn how to handle files in Python programming. File management is a crucial skill for any Pytho...

  •  Object Persistence Techniques

    Welcome to Object Persistence Techniques! In this lesson, you will explore how to store and retrieve objects in Python using various persistence techniques...

  •  Working with Relational Databases

    Welcome to Working with Relational Databases! In this lesson, you will learn how to interact with relational databases using Python. Relational databases, such...

  •  Memory Management Techniques

    Welcome to Memory Management Techniques! In this lesson, you will learn how to efficiently manage memory in Python. Memory management is a critical aspe...

  •  Using Extra Libraries

    Welcome to Using Extra Libraries in Python! In this lesson, you will learn how to extend the functionality of your Python programs by using the powerful sta...

 Maybe you will be interested in these Python Programming Exercises

  •  Functions: Hello and Goodbye

    In this exercise, you will develop a Python program where the main function should look like this: SayHello() and SayGoodbye(). You must define the functions SayHello...

  •  Parameterized Function

    In this exercise, you will develop a Python program where the main function should look like this: SayHello("John") and SayGoodbye(). You must define the functions Sa...

  •  Value-Returning Function

    In this exercise, you will develop a Python program where the main function should define and call a sum function that accepts two integers as parameters and returns ...

  •  Value-Returning Function V2

    In this exercise, you will develop a Python program where the main function should look like this: def main(): print("\"Hello, how are you\" contains {0} spaces".form...

  •  Centered Text Function

    In this exercise, you will develop a Python function named "get_int" that displays the text received as a parameter, prompts the user for an integer number, repeats i...

  •  Underline Text Function

    In this exercise, you will develop a Python function that can center the text on the screen (assuming a screen width of 80 characters) and then underline it with hyph...