Unit 4 - Lesson 3

36.1.1. Introduction to Lists

(c)Lists are ordered and can contain other lists as elements.

36.1.2. Understanding Creation of List

data = input("data: ")
# print type of input data here
print("type of data:",type(data))

list1 = data.split() # split() is used to convert a string into list

# print list1
print("list:",list1)
# print type of list1
print("type of list:",type(list1))

36.1.3. Write a Program to create a List

data=input("data: ")
l= data.split(',')
print("list:",l)
print("type of list:",type(l))

36.1.4. Different Types of Lists

list1 = ["Python", 100, "Lists", 8.8,'A', "Program"]
# print the list1 items
print("List1 contains:",list1)
# print the type of list1
print("Type of list1:",type(list1))

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.