Write a python program to perform any 5 built-in functions by taking any list.

 # Sample list

numbers = [5, 10, 15, 20, 25]

print("Original List:", numbers)


# 1. len() – to get the number of elements

print("Length of list:", len(numbers))


# 2. sum() – to get the sum of all elements

print("Sum of elements:", sum(numbers))


# 3. max() – to get the maximum value

print("Maximum element:", max(numbers))


# 4. min() – to get the minimum value

print("Minimum element:", min(numbers))


# 5. sorted() – to sort the list in ascending order

sorted_list = sorted(numbers)

print("Sorted List:", sorted_list)

Output:


Comments