-
The user can interact with the program through a numbered menu, selecting which operation to perform.
-
The program uses the append()
, insert()
, extend()
, pop()
, and sort()
list methods to manipulate the list.
-
The user can also exit the program by selecting option 10.
-
Program 9-4 calculates the average marks of n students using a function.
-
The user is asked to input the number of students (n), and then the marks for each student are input and stored in a list.
-
The computeAverage()
function calculates the average marks of the students by summing the elements in the list and dividing by n.
-
The average marks are then printed.
-
Program 9-5 defines a function linearSearch()
that checks if a number is present in a list or not.
-
If the number is present, the function returns its position in the list.
-
If the number is not present, the function returns None
.
-
The user inputs the list elements and the number to be searched.
-
The function is called with the list and number as arguments, and the output is printed.