Write the Python code for the following programming problem below. You do not ha
ID: 3635070 • Letter: W
Question
Write the Python code for the following programming problem below. You do not have to use modular design.Combine Exercise 1 and 2 of Chapter 9. Write a program that will allow the user to enter the name and golf score for any number (n) of golfers. Next, sort the data in descending order by golf score using the Bubble Sort. Then display the golfers name and golf score.
Hints:
1. Create two parallel arrays of size n each. n, the number of golfers, will be entered by the user at the beginning of the program logic. One string array will store the golfer’s name, the second numeric integer array will store the golfer’s score. These variables might be defined as follows:
golferName=str.array(itemsize=20,shape=n)
golferScore(n,Int)
2. Don’t forget these two arrays are parallel and elements from both arrays have to be swapped correspondingly using the Bubble Sort for parallel arrays.
3. Don’t forget the imports needed for arrays in Python.
Explanation / Answer
//main module def Main() int index=0 //global variables SIZE=Input("Enter the number of golfers >>>") while index scores[index+1] then swap(scores[index], scores[index+1]) swap(Names[index], Names[index+1]) def swap(a,b) //swap the values in a and b temp = a a = b b = tempRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.