Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

find the second maximum in python

0 votes
asked Jun 1, 2019 by PERUMALLA PRIYANKA ECE DEPT (120 points)

2 Answers

0 votes
answered Jun 3, 2019 by sowmiya E
L=[1,2,3,4,5,6,7,8]

max=L[0];

max2=L[0];

for i in L:

    m=i;

    if(m>max):

        max2=max;

        max=m;

    else if(m>max2):

        max2=m;

    else:

        continue;
+1 vote
answered Jun 7, 2019 by SatyoJena (200 points)
a list is given. say.   l
there is a function sort().   used as
                              l.sort()
then,the list will be sorted in increasing order.
then find the second element from last i.e.
                                l[-2].
commented Jun 9, 2019 by bhanu (100 points)
how i will be incremented
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...