# Flowchart to sort the list of numbers in python-my programming school

Flowchart to sort the list of numbers in python

B) to develop a flowchart to sort the list of numbers.
Purpose: To draw a flowchart for sorting array elements.
Algorithm:
Step1: Start
Step 2: Enter the array size and read as n.
Step 3: Enter the array elements and read as [i].
Step 4: Print the array elements before sorting.
Step5: After sorting, print the statement array elements.
Step6: Take 2 nested loops, take i variable in 1 loop, and j variable in 1 loop.
Step7: Check condition i> n in the I loop.
Step8: If the condition is false, go to the j loop. Go to the other end.
Step9: In j loop, check condition [j]> [a + j + 1].
Step10: If the condition is true, swap one [j] and one [j + 1]. Otherwise go to the end.
Step11: Print the array elements [i].
Step 12: End

Flow Chart:

Input:

enter the array size:5

Enter element1:30

Enter element2:50

Enter element3:40

Enter element4:10

Enter element5:70

Output:

array elements before sorting

30

50

40

10

70

array elements after sorting

10

30

40

50

70

—-Run complete.  200 symbols evaluated.—-

Some Example Programs:

Syntax:
variableName.sort(reverse=True)

Short number [43, 12, 6, 78, 2, 14]

example:
scores.sort(reverse=True)

# Find top three greatest number which is equal to [78, 43, 14]

Source Code:
def top_three(scores):
top_scores=[]
for i in scores:
top_scores.append(i)

scores = [43, 12, 6, 78, 2, 14]
scores.sort(reverse=True)
print(“After sorted Elements are: “,scores)
print(top_three(scores[:3]))

OutPut:
“C:\Program Files\Python37\python.exe” “C:/Users/user/Python EX/helloworld/sorting and comparing.py”

After sorted Elements are: [78, 43, 14, 12, 6, 2]
True

Process finished with exit code 0

Flowchart to sort the list of numbers in python

https://en.wikipedia.org/wiki/Sorting_number

https://en.wikipedia.org/wiki/Sorting

https://en.wikipedia.org/wiki/Integer_sorting

https://en.wikipedia.org/wiki/List_of_types_of_numbers

### Domain & free Hosting

You have successfully subscribed to myprogrammingschool

There was an error while trying to send your request. Please try again.

My Programming School will use the information you provide on this form to be in touch with you and to provide updates and marketing.