In this video,we learn how to Create a list in Python?
Creating a list in Python is quite simple. Lists are used to store collections of items, and they can contain elements of different data types, including numbers, strings, or even other lists. Here's how you can create a list:
Creating an empty list
my_list = []
Creating a list with elements
my_list = [1, 2, 3, 4, 5]
Creating a list of strings
my_list = ["apple", "banana", "cherry"]
Creating a list with mixed data types
my_list = [1, "apple", 3.14, True]
Creating a list of lists (nested list)
nested_list = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
You can also create a list using the list() method by passing an iterable (e.g., a string, tuple, or another list) as an argument:
Creating a list from a string
my_list = list("Hello") # Results in ['H', 'e', 'l', 'l', 'o']
To watch more videos ,visit the playlist- • Basic Coding Skills in Python|Fundame...
Introduction to Python- • Introduction to Python|What is Python...
How to install Python- • How to install Python|Python kaise in...
How to download PyCharm- • How to download Pycharm|PyCharm kaise...
How to Create first "Hello World"
or "Hello Rajat" program - • How to Create "Hello World" or "Hello...
Rules of Variables in Python- • Rules of variables in Python|What is ...
Python Arithmetic Operators- • What are Operators in Python|Python A...
Python Relational Operators- • What are Relational or Comparison Ope...
Python Logical Operators- • What are Logical Operators|Logical Op...
Python Assignment Operators- • What are Assignment Operators|Assignm...
Data types and input() function in Python- • What are Data Types in Python|Use of ...
Comments in Python - • Comments in Python|Python Programs us...
Difference between Compiler and Interpreter- • Compiler vs Interpreter|Difference be...
Bugs or Errors in a Program- • What are bugs or errors in a program?...
Python Conditional if statement - • Python Conditional Statements|Python ...
Python Conditional if-else statement- • Python Conditional Statements|if-else...
if-elif-else and nested if statements- • Python Conditional Statements|if-elif...
Programs of Conditional Statements- • Programs of Conditional Statements|Pr...
Iterations,Algorithm and Flowchart- • while loop|Use of while loop in Pytho...
Use of while loop in Python- • while loop|Use of while loop in Pytho...
Python Programs of while loop- • Programs of while loop|Python Program...
for loop in Python- • for loop|for loop in Python|Use of fo...
Programs of for loop in Python- • Python Programs of for loop|for loop ...
Jump Statements in Python- • Jump Statements in Python|break, cont...
Strings in Python- • Strings in Python|Concept of Indices ...
Accessing String characters in Python- • Accessing String Characters in Python...
String Operators in Python- • String Operators in Python|Concatenat...
String Slicing in Python- • String Slicing in Python|String Index...
String Functions in Python(Part-a)- • String functions in Python|Use of Str...
String Functions in Python (Part-b)- • String functions in Python (Part-b) |...
Python Programs of String- • Python Programs of String|Programs of...
Python lists- • Python Lists|Lists in Python|What are...
In questa pagina del sito puoi guardare il video online How to Create a list in Python?|Creating a list in Python|Python list della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Rajat Srivastava0709 05 September 2023, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 6 volte e gli è piaciuto 1 spettatori. Buona visione!