You can easily create a list by using square brackets, where the elements are placed inside square brackets (), separated by commas
mylist = ["A", "B", "C"]
Example code list in Python
Simple example code. An important point about List is List elements are ordered, changeable, and allow duplicate values.
furit_list = ["apple", "banana", "cherry"] print(furit_list) print(type(furit_list))
List items can be of any data type:
list1 = ["A", "B", "C"] list2 = [1, 5, 7, 9, 3] list3 = [True, False, False]
Do comment if you have any doubts or suggestions on this Python basics topic.
Note: IDE: PyCharm 2021.3 (Community Edition)
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.