P09: Golf Scores Write the Python code for the following programming problem bel
ID: 3624844 • Letter: P
Question
P09: Golf ScoresWrite 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. Exercise 1 Sorted golf scores :( design a program that asks the user to enter 10 golf scores. the scores should be stored in an Integer array. Sort the array in ascending order and display its contents). Exercise 2 Sorted Names :(design a program that allows the user to enter 20 names into a String array. Sort the array in ascending ( alphbetical order) and display its contents.
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.
Your sample output might look as follows:
Enter the number of golfers >>> 5
Enter the name of the golfer >>> Hoyle
Enter the score for Hoyle >>> 85
Enter the name of the golfer >>> Lee
Enter the score for Lee >>> 79
Enter the name of the golfer >>> Blalock
Enter the score for Blalock >>> 90
The rank for the golfer’s is:
Blalock 90
Hoyle 85
Lee 79
Happy Golfing!
Explanation / Answer
check out this site: http://ask.metafilter.com/178860/Python-for-beginners
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.