Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Python list function tutorial

list1 = [10, 20, 4, 45, 99]
 
mx=max(list1[0],list1[1])
secondmax=min(list1[0],list1[1])
n =len(list1)
for i in range(2,n):
    if list1[i]>mx:
        secondmax=mx
        mx=list1[i]
    elif list1[i]>secondmax and 
        mx != list1[i]:
        secondmax=list1[i]
 
print("Second highest number is : ",
      str(secondmax))
      
 Output:-     
      
Second highest number is :  45
Comment

Python list tutorial

Vowel=['a','e','i','o','u']
if 'e' in Vowel:
print('Present')
else:
print('absent')
Comment

PREVIOUS NEXT
Code Example
::  
Python :: python group by 
:: sklearn.metrics accuracy_score 
Python ::  
:: Python program to calculate area of a rectangle using function 
:: np.pad 
:: typing racer 
:: export an excel table to image with python 
Python ::  
::  
Python :: python round 
:: show columns with nan pandas 
Python :: pandas python tutorial 
Python :: shape function python 
Python :: round down py 
:: how to remove trailing zeros in python 
Python ::  
::  
Python ::  
Python :: python pattern 
::  
::  
:: python port forwarding 
Python :: how to clear combobox tkinter 
:: python how do index all odd numbers in a list 
Python :: how to remove text in pygame 
::  
Python ::  
:: how to create file organizer using python 
Python :: configure your keyboards 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =