Respuesta :
Using the knowledge in computational language in python it is possible to write a code that through a list manages to organize the largest and smallest numbers in order.
Writting the code in python:
# finding largest in the list
list_max = challenge3[0]
for i in range(len(challenge3)) :
if challenge3[i] > list_max :
list_max = challenge3[i]
print("largest in the list = ", list_max)
# number of times largest occurs in list
max_count = 0
for i in range(len(challenge3)) :
if challenge3[i] == list_max :
max_count += 1
print("number of times largest occurs in list = ", max_count)
# finding second largest in the list
list_sec_max = challenge3[0]
for i in range(len(challenge3)) :
if challenge3[i] > list_sec_max and challenge3[i] < list_max :
list_sec_max = challenge3[i]
print("second largest in the list = ", list_sec_max)
# number of times second largest occurs in list
sec_max_count = 0
for i in range(len(challenge3)) :
if challenge3[i] == list_sec_max :
sec_max_count += 1
print("number of times second largest occurs in list = ", sec_max_count)
# location of first occurence of largest in the list
first_index = -1
for i in range(len(challenge3)) :
if challenge3[i] == list_max :
first_index = i
break
print("location of first occurence of largest in the list = ", first_index)
# location of first occurence of largest in the list
last_index = -1
for i in range(len(challenge3) - 1, -1, -1) :
if challenge3[i] == list_sec_max :
last_index = i
break
print("location of first occurence of largest in the list = ", last_index)
See more about python at brainly.com/question/13437928
#SPJ1
