0% found this document useful (0 votes)
12 views

What Is The Output ? Mylist (1,2,3,4,5,6,7,8,9,10) For I in Range (0, Len (Mylist) ) : If I%2 0: Print (Mylist (I) )

The document contains examples of Python list operations and questions to test list comprehension. It shows how to print specific elements, slice lists, check length, find maximum/minimum/index and modify list elements.

Uploaded by

ffffffg
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

What Is The Output ? Mylist (1,2,3,4,5,6,7,8,9,10) For I in Range (0, Len (Mylist) ) : If I%2 0: Print (Mylist (I) )

The document contains examples of Python list operations and questions to test list comprehension. It shows how to print specific elements, slice lists, check length, find maximum/minimum/index and modify list elements.

Uploaded by

ffffffg
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

1. What is the output ?

Mylist=[1,2,3,4,5,6,7,8,9,10]
For I in range(0,len(mylist)):
If i%2==0:
Print(mylist[i])

2.
a = [1, 2, 3, 4, 5, 6, 7, 8, 9]
b = a.pop(5)
c = a.pop( )
d = a.pop(-1)
print(b)
print(c)
print(d)
print(a)

3.
Write the output of the following:
a = [11,42,31,14]
print(max(a))
print(min(a))
print(a.index(42))

4.
Write the output of the following
>>> a = [1,2,3,4]
>>> a.append([7,8])
>>> a

5.
b = “Practice Questions of List in Python“
            a=list(b)
            1.          print(a)
            2.          print(len(a))
            3.          print(a[1:4])
            4.          print(a[1:7])
            5.          print(a[3:])
            6.          print(a[:5])
            7.          print(a[4:17])
            8.          print(a[-2:-5:-1])
            9.          print(a[1:7:1])
            10.       print(a[1:7:2])
            11.       print(a[-5:])
            12.       print(a[:4])
            13.       print(a[-2:-5:-2])
            14.       print(a[11:15])
            15.       print(a[:])
            16.       print(a[::2])
            17.       print(a[-5:-1])
            18.       print(a[7:1:-1])
            19.       print(a[3:-3])
            20.       print(a[30:40])
            21.       print(a[17:-1])
            22.       print(a[10::-1])
6.

9. Find the output of the following code:


Name="PythoN3.1"
R=""
for x in range(len(Name)):
if Name[x].isupper():
R=R+Name[x].lower()
elif Name[x].islower():
R=R+Name[x].upper()
elif Name[x].isdigit():
R=R+Name[x-1]
else:
R=R+"#"
print(R)

10. The record of a student (Name,Roll No,Marks in five subjects and percentage of marks ) is
stored in the following list:
Record=[“Raman”,”A-35”,[55,95,99,72,69],78.8]
Write Python statements to retrieve the following information from the list Record
(a) Percentage
(b) Marks in the 5th subject
(c) Maximum marks of the student.
(d) Roll no of the student
(e) Change the name of the student from Raman to Raghav

You might also like