PYTHON LISTS
Q1. Write Python script to display the element with maximum value from the
given list.
Show/Hide Program
list=[11,12,34,77,99,34,23,22]
a=max(list)
print(a)
Q2. Write Python script to display the element with minimum value from the
given list.
Show/Hide Program
list=[11,12,34,77,99,34,23,22]
b=min(list)
print(b)
Q3. Write Python script to display the sum of elements from the given list of
numbers.
Show/Hide Program
list=[11,12,34,77,99,34,23,22]
n=0
m=len(list)
for i in list:
n=n+i
print(list)
print("sum of the list elements is",n)
Q4. Write Python script to display the average of elements from the given list
of numbers.
Show/Hide Program
list=[11,12,34,77,99,34,23,22]
n=0
m=len(list)
for i in list:
n=n+i
print(list)
print("Average of the list elements is", n/m)
Q5. Writ a Python script to input a list of numbers and a number. Check
whether the given number is present in the list or not.
Show/Hide Program
a=eval(input(“enter a list “))
b=eval(input(“enter a number”))
flag=0
for i in a:
if i!=b:
continue
else:
flag=1
if flag==1:
print(“present”)
else:
print(“not present")
Q6. Write a Python script to input a list and find all duplicates and display
number of times they are present in the list.
Show/Hide Program
a=input(“enter a list”)
r=max(n)
for I in range(r+1):
c=[Link](I)
if c!=0:
print(I, “has appeared “,c ,”times in the list”)