answersLogoWhite

0


Best Answer

/////////START OF PROGRAM/////////// //the main module Module Main() //declare constant variable Constant Integer SIZE=10 Constant String DAY=10 Set DAY[1] = first Set DAY[2] = second Set DAY[3] = third Set DAY[4] = forth Set DAY[5] = fifth Set DAY[6] = sixth Set DAY[7] = seventh Set DAY[8] = eighth Set DAY[9] = ninth Set DAY[10] = tenth //global variables Declare Integer scores[SIZE] Declare String scores[DAY] Declare Integer index //body of the module //sets the constants in the scores array to 1 Set scores[DAY=1] Set scores Do Display "Please enter the ", scores[DAY]," Golf score :" Set scores[DAY+1] Input scores[SIZE+1] until scores[SIZE==10] End Do //calls the insertionSort module Call insertionSort(scores, SIZE) //display the scores sorted ascendedly Display "You golf scores sorted ascendedly are: " For index = 0 to SIZE - 1 Display scores[index] End For End Module

User Avatar

Wiki User

10y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

7y ago

Use a single-pass insertion sort with each input value. The algorithm is as follows:

Algorithm: insert_sort

Inputs: a sorted array A of count N elements and a value V

Outputs: array A of size N+1 with value V inserted in sorted order

let gap = N // store index one-past-the-end of the array

let N = N + 1 // increment the size of the array

A.resize (N) // reallocate (last element is unused at this point)

while (0<gap AND V<A[gap-1]) // adjust insertion point...

A[gap] = A[gap-1] // the value to the left of the gap is larger than V, so copy it into the gap

let gap = gap - 1 // move the gap one position to the left

end while

// at this point, A[gap] is the insertion point (any values after gap are greater than V)

let A[gap] = V // insert the new value into the gap

return A // the sorted array

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you design a program that asks the user to enter 10 golf score in python that should be stored in an integer array and sorted in ascending order?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Sort array in ascending descending order in python?

Using sorted(array,reverse=True)


What has the author Wesley Chun written?

Wesley Chun has written: 'Python fundamentals' -- subject(s): Python (Computer program language) 'Core Python programming' -- subject(s): Python (Computer program language)


Do you need Python in your PC?

Python is just a programming software, you don't actually need it to run your computer. You can use Python if you'd like to program something, or learn how to program.


How do you open a Python program with MS-DOS?

open MS-DOS in the directory you have the python file in. type "python [INSERTNAMEOFSCRIPT]"


Where does the program python run?

Python is a runtime interpreter. It usually runs on the web server.


Write a line of code that asks the python user to input an integer greater than 0 and store this value in a variable and display its value?

integer = input(&quot;Please input an integer greater than 0: &quot;) print(integer)


What is a good book to learn how to program in python?

Think Python,A byte of python Invent Computer games with pythonAre three possibles, and all are free and libre


Where did the computer language called PYTHON get its name?

Python is named after the comedy troupe Monty Python, not the genus of snake. The creators of Python intended it to be fun to program in, and hoped to reflect that in its name.


How do you convert float into string in python program?

str(3.1415)


How do you program a python 488p car alarm?

488P Is the remote to a Python car alarm, need to be more specific on the alarm you have.


How do you get python?

Python, the snake, requires special licences as well as expert care and feeding. The programming language Python, the computer program, can be downloaded for free for most operating systems at the Org site for Python or at sourceforge


What x 84 program?

The program x/84 is an experimental python Telnet and SSH server framework.