Manipulating Python Lists Fundamentals

PythonPythonBeginner
Practice Now

Introduction

Let's start implementing list manipulation with Python! In this challenge, you will learn how to query elements in a list.

Achievements

  • List
  • Data Types
  • 'input()' Function

Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL python(("Python")) -.-> python/DataStructuresGroup(["Data Structures"]) python(("Python")) -.-> python/FunctionsGroup(["Functions"]) python/DataStructuresGroup -.-> python/lists("Lists") python/FunctionsGroup -.-> python/build_in_functions("Build-in Functions") subgraph Lab Skills python/lists -.-> lab-64{{"Manipulating Python Lists Fundamentals"}} python/build_in_functions -.-> lab-64{{"Manipulating Python Lists Fundamentals"}} end

Query of Elements 1

Write code that outputs the corresponding element after entering the index of the element in the list.

The list is as follows:

_list = [1, 3, 'Aaron', "Google", 2.33]

Example

Example list query output

Requirements

  • The program should be named /home/labex/project/element_query1.py.
  • Do not modify the elements in the list.
โœจ Check Solution and Practice

Query of Elements 2

Write code that outputs the corresponding index after entering the elements in the list.

The list is as follows:

_list = ["g", "r", "o", "u", "n", "d"]

Example

Example list index query

Requirements

  • The program should be named /home/labex/project/element_query2.py.
  • Do not modify the elements in the list.
โœจ Check Solution and Practice

Summary

In this challenge, you learned how to manipulate a list. You can now query elements in a list using their index or the element itself. This is a fundamental skill that will help you work with lists in Python.