Python

LIST in python

LIST

  • List is an ordered sequence of items.
  • It is one of the most used data type in python and is very flexible.
  • All the items in list do not need to be of same type.
  • List is one of 4 built-in data types in Python used for collection of data, the other 3 are Tuple , set and Dictionary.
  • List is created using square brackets.

Example:1

nums=[12,34,56,78,89,12]
print(nums)

output: [12, 34, 56, 78, 89, 12]

Items in a list

  • Items in a list are changeableordered  and allow duplicate values.
  • List items are indexed, starting from [0] index value.

Ordered

  • Here the term ordered refers that, it means the items have a defined order, and this order cannot be changed.
  • If  in case any new items are added to the list that will be placed at the end of the list.

Changeable

  • Here the term changeable indicates that the values in a list can be removed, added or changed after the creation of list.

Allow Duplicates

In a list  it allows us to  have the  repeated values

Example2

>> lst=[12, 34, 45, 67, 89,12]

>>print(lst)

Indexing in list

  • In list indexing is as in string i.e., left to right for reversal printing then indexing is done from right to left.
  • If you want to pick up the third value that is second indexed value then

Example:

Lakshmi Durga

Share
Published by
Lakshmi Durga

Recent Posts

Samsung TV Red Light Blinking? 4 Fixes (2026 Power Logic Hub)

User Problem Scenario: The Red Light "Panic" You press the power button on your Samsung…

5 days ago

Samsung TV Not Connecting to WiFi: 2026 Easy Fix Guide

Introduction: I Know the Feeling "We’ve all been there. You sit down to watch your…

6 days ago

Samsung TV Restarting During Diagnosis? Fix the Reboot Loop Fast

User Problem Scenario: The "Diagnosis Loop" Paradox Imagine you notice your apps are slow. You…

6 days ago

Samsung TV Optimize Now Not Working? (2026 Fix: Greyed Out, Stuck or Not Responding)

🎓 Technical Module: Memory Maintenance Logic Module: WV-OS-307 Verified 2026 👨‍🏫 Instructor: Vangari Divya (M.Tech)…

1 week ago

Samsung Smart Hub Test Failed? (2026 Fix: DNS, ISP Block & Authentication Error)

 Introduction: The Setup Paradox "There is a specific moment of frustration for every Samsung Smart…

2 weeks ago

Samsung TV Picture Test Not Working? 4 Technical Recovery Fixes

Introduction: Lab Diary & Experience "When your Samsung TV screen begins to flicker or show…

2 weeks ago