[Type C]Q3. Write a python program directed for the Linear Lists in the problem statement.

What are Linear Lists?

A list is a collection that is ordered and changeable. In Python, lists are written with square brackets.

Lists are just like dynamic sized arrays, declared in other languages. Lists do not need to be homogeneous always, which makes it a most powerful tool in Python.

A single list may contain DataTypes like Integers, Strings, as well as Objects.

Lists are mutable, and hence, they can be altered even after their creation.

List Operations: Some common functions of lists are

Append()Add an element to the end of the list
Extend()Add all elements of a list to the another list
Insert()Insert an item at the defined index
Remove()Removes an item from the list
Pop()Removes and returns an element at the given index
Clear()Removes all items from the list
Index()Returns the index of the first matched item
Count()Returns the count of number of items passed as an argument
Sort()Sort items in a list in ascending order
Table of most used functions of list.

Problem: Use a list comprehension to create a list, CB4. The comprehension should consist of the cubes of the numbers 1 through 10 only if the cube is evenly divisible by four. Finally, print that list to the console. Note that in this case, the cubed number should be evenly divisible by 4, not the original number.

Program code:

Output:

8
64
216
512
1000

In the above code snippet basic functions of list are demonstrated.

To view all the lessons in chapter 9: http://computertutor.in/class-12-computer-science/chapter-9/

To view entire class 12 computer science study material: http://computertutor.in/resources/

You cannot copy content of this page