Python Lists: Basics and Applications

PYTHON JOURNEY - Day 34 / 50..!! TOPIC – Python Lists (Basics) Today I explored Lists in Python — a powerful way to store multiple items in a single variable. 1. Creating a List Python fruits = ["Apple", "Banana", "Cherry"] print(fruits) 2. Accessing Items (Indexing) Python starts counting at 0! Python fruits = ["Apple", "Banana", "Cherry"] print(fruits[0]) # Output: Apple print(fruits[-1]) # Output: Cherry (Last item) 3. Adding & Removing Items Python fruits.append("Orange") # Adds to the end fruits.remove("Banana") # Removes specific item print(fruits) Why Use Lists? Keep related data organized They are "mutable" (you can change them after creation) Can hold different data types (Strings, Integers, etc.) Mini Task Write a program that: Creates a list of your 3 favorite movies. Adds one more movie to the list using .append(). Prints the first movie and the total length of the list using len(). #Python #PythonLearning #50DaysOfPython #DailyCoding #LearnPython #CodingJourney #PythonForBeginners #LinkedInLearning #DeveloperCommunity

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories