Question: def create _ list ( ) : # Create an empty list and prompt for the number of integers lst = [ ] num _
def createlist:
# Create an empty list and prompt for the number of integers
lst
numvalues intinputEnter number of integers in list:
for i in rangenumvalues:
value intinputfEnter item #i :
lstappendvalue
return lst
def secondhighestlst:
# Create a deep copy of the list and sort it to find the second highest
sortedlst lstcopy
sortedlstsort
return sortedlst # Return the second largest element
def makepositivelst:
# Modify the list to make all elements nonnegative
for i in rangelenlst:
if lsti:
lsti abslsti
def main:
# Create the list of integers
mylist createlist
printMy original list:", mylist
# Find the second highest integer
secondlargest secondhighestmylist
printfSecond largest integer in list is secondlargest
# Make all elements in the list positive
makepositivemylist
printMy now positive list is mylist
if namemain:
main
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
