Question

# USE PYTHON LANGUAGE PLEASE FOCUS YOU SHOULD ENTER AN ARRAY AND THEN THE PROGRAM GIVE OUTPUT(...

USE PYTHON LANGUAGE

YOU SHOULD ENTER AN ARRAY AND THEN THE PROGRAM GIVE OUTPUT( TRUE/ FALSE)

QUIZ 8 Array Challenge Have the function ArrayChallenge(arr) take the array of numbers stored in arr and return the string true if any two numbers can be multiplied so that the answer is greater than double the sum of all the elements in the array. If not, return the string false. For example: if arr is [2, 5, 6, -6, 16, 2, 3, 6, 5, 3] then the sum of all these elements is 42 and doubling it is 84. There are two elements in the array, 16 * 6 = 96 and 96 is greater than 84, so your program should return the string true.

Examples

Input: [2, 2, 2, 2, 4, 1]
Output: false

Input: [1, 1, 2, 10, 3, 1, 12]
Output: true

I have uploaded the Images of the code, Typed code and Output of the Code. I have provided explanation using comments(read them for better understanding).

Images of the Code:

Note: For indentation please refer code Images

Typed Code:

# A function called ArrayChallenge with arr parameter
def ArrayChallenge(arr):
#calculating the sum of the arr using sum function
#And then doubled it by multiplying with 2
#and stored it in variable called double_sum
double_sum=sum(arr)*2;

#Accessing the all elements in arr
for i in range(0,len(arr)):
#Accessing elements after arr[i]
for j in range(i,len(arr)):
# multiplying the elements and checking
#whether it is greater than double_sum
if(arr[i]*arr[j]>double_sum):
#returning a string true
return "true"
#if any two numbers can be multiplied
#and that the answer is not greater than double_sum
return "false"

#Creating a list
arr=[2, 5, 6, -6, 16, 2, 3, 6, 5, 3]
#calling function ArrayChallenge
print(ArrayChallenge(arr))

#Creating a list
arr=[1, 1, 2, 10, 3, 1, 12]
#calling function ArrayChallenge
print(ArrayChallenge(arr))

#Creating a list
arr=[2, 2, 2, 2, 4, 1]
#calling function ArrayChallenge
print(ArrayChallenge(arr))
#code ended here

Output:

Have A Great Day!

#### Earn Coins

Coins can be redeemed for fabulous gifts.