# 1) Add elements to a list and print the final list.
lst = [10, 20, 30, 40, 50]
# [10, 20, 30, 40, 50]
# 2) Find the sum and average of elements in a list.
total = sum(lst)
average = total / len(lst)
# Sum = 150, Average = 30.0
# 3) Find the maximum and minimum element in a list.
maximum = max(lst)
minimum = min(lst)
# Max = 50, Min = 10
# 4) Count the frequency of an element in a list.
freq = lst.count(20)
# Frequency of 20 = 1
# 5) Remove all duplicates from a list
dup_list = [10, 20, 20, 30, 10, 40]
no_dup = list(set(dup_list))
# [40, 10, 20, 30] # (order may vary)
# 6) Reverse a list without using reverse() method
reversed_list = lst[::-1]
# [50, 40, 30, 20, 10]
# 7) Find even and odd numbers separately from a list
even = [x for x in lst if x % 2 == 0]
odd = [x for x in lst if x % 2 != 0]
# Even = [10, 20, 30, 40, 50], Odd = []
# 8) Merge two lists and sort the result
list1 = [10, 30, 50]
list2 = [20, 40, 60]
merged = sorted(list1 + list2)
# [10, 20, 30, 40, 50, 60]
# 9) Check if a list is a palindrome
palindrome_list = [1, 2, 3, 2, 1]
is_palindrome = palindrome_list == palindrome_list[::-1]
# True
# 10) Find the second largest number in a list.
unique_sorted = sorted(set(lst))
second_largest = unique_sorted[-2]
# 40