Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help with Python. I need to write this pseudocode into Python. I have done it but it is not giving me output -1. However, it

Help with Python. I need to write this pseudocode into Python. image text in transcribed

I have done it but it is not giving me output -1. However, it should output -1, 34, 52 when I put it the sample input. I cannot seem to get it to work properly.. The following is my code in Python:

def integerAnalyzer(): sizeOfArray = int(input("enter size of array A")) A = [None] * sizeOfArray for i in range(len(A)): elementChange = int(input("enter A[%d]" % (i))) A[i] = elementChange i = i + 1 A.sort() b = len(A)/2 for i in range(b): s = 0 for j in range(i): s = s + A[j] + A[len(A)-j-1] print (s) integerAnalyzer() 
INTEGERANALYZERO A = INTARRAY(READ?NTO) for i=0to n _ 1 do A[i] READINTO end for SORT(A) for i = 0 to L(n-1)/2] do for j 0 to i do end for PRINT!NT(s) end for INTARRAY(n) creates an integer array of size n. READINTO reads an integerfrom standard input. PRINT!NT(S) prints s to standard output. SORT sorts an array in ascending order (use the built-in function in your chosen programming language) Sample Input Sample Output 5 3 9 42-43 32 1 34 52 INTEGERANALYZERO A = INTARRAY(READ?NTO) for i=0to n _ 1 do A[i] READINTO end for SORT(A) for i = 0 to L(n-1)/2] do for j 0 to i do end for PRINT!NT(s) end for INTARRAY(n) creates an integer array of size n. READINTO reads an integerfrom standard input. PRINT!NT(S) prints s to standard output. SORT sorts an array in ascending order (use the built-in function in your chosen programming language) Sample Input Sample Output 5 3 9 42-43 32 1 34 52

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Relational Theory Normal Forms And All That Jazz

Authors: Chris Date

1st Edition

1449328016, 978-1449328016

More Books

Students also viewed these Databases questions

Question

4. Make recommendations on steps to take to melt the glass ceiling.

Answered: 1 week ago

Question

1. Discuss the potential legal issues that relate to training.

Answered: 1 week ago