1.

Write a program to input 10 numbers in a list find the greatest and second greatest number​

Answer»

a(n-2) Explanation:Here is source code of the Python PROGRAM to find the SECOND largest number in a list. The program output is also shown below.a=[]n=int(input("Enter number of elements:"))for i in RANGE(1,n+1): b=int(input("Enter element:")) a.append(b)a.sort()print("Second largest element is:",a[n-2])Program Explanation1. User must enter the number of elements and store it in a variable.2. User must then enter the elements of the list one by one using a for LOOP and store it in a list.3. The list should then be sorted.4. Then the last element of the list is printed which is also the largest element of the list.



Discussion

No Comment Found