/////////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
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
Using sorted(array,reverse=True)
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.
open MS-DOS in the directory you have the python file in. type "python [INSERTNAMEOFSCRIPT]"
str(3.1415)
Simply writing "quit()" will end the script.
Using sorted(array,reverse=True)
Wesley Chun has written: 'Python fundamentals' -- subject(s): Python (Computer program language) 'Core Python programming' -- subject(s): Python (Computer program language)
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.
open MS-DOS in the directory you have the python file in. type "python [INSERTNAMEOFSCRIPT]"
Python is a runtime interpreter. It usually runs on the web server.
integer = input("Please input an integer greater than 0: ") print(integer)
Think Python,A byte of python Invent Computer games with pythonAre three possibles, and all are free and libre
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.
str(3.1415)
488P Is the remote to a Python car alarm, need to be more specific on the alarm you have.
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
The program x/84 is an experimental python Telnet and SSH server framework.