Flowchart to find largest element in an array in python
Develop a flowchart to find the largest element in an array in python. In this, we have to find the largest element which is entered by the user. we will also see max and min difference and max and min using def.
Aim to find max in list Python
In this program, we will learn to draw the flowchart for finding the largest element in the array.
Algorithm to find largest element in an array
- Step-1: Start
- Step-2: Enter the array size and read as n.
- Step-3: Enter the array elements and read as a[i].
- Step-4: Initialize to i and a[i] to large.
- Step-5: In i loop check the condition i>n-1.
- Step-6: check the condition a[i+1]>large
- Step-7: If the condition is true then assign a[i+1] to large, otherwise go to next iteration.
- Step-8: Print the largest element in an array in python
- Step- 9: End
Diagram of flowchart to find largest element
Python program to find largest number in an array
Find maximum and minimum number using max() and min() function
num1=[163,45,28,85,214,101]
print("Minimum value is:",min(num1))
print("Maximum value is:",max(num1))
# ...........................
Find max and min difference
def max_Min_diff(num):
return max(num) - min(num)
num1=[163,45,28,85,214,101]
print("The difference of max and min is:",max_Min_diff(num1))
# .................................................................
Max and Min using def
def max_min(num):
return "maximum:->",max(num),"minimum:-> ",min(num)
num1=[163,45,28,85,214,101]
print(max_min(num1))
# .................................................................
Recommended Posts:
- How to Become a Machine Learning Engineers – easy Step by Step Guide
- Python Difference Between Two Lists using Python Set and Without Set
- How to Open file in python|Read File Line by Line with Examples
- Python String Find() Method Explained with Examples
- How to Generate Random Numbers in Python with Examples
Get Salesforce Answers