What is the output of the program below? (Note: This program works as expected) #************************************* # Final Exam #************************************* pear = 7 peach = 8 #************************************* # Function: main #************************************* def main(): banana = [1, 2, 3, 4, 5] print(banana, pear, peach, "BEFORE FUNCTION") FinalExamFunction(banana) print(banana, pear, peach, "AFTER FUNCTION") # End of the Main Function #************************************* # Function: FinalExamFunction #************************************* def FinalExamFunction(apple): global pear pear = apple[0] apple[0] = apple[4] apple[4] = pear peach = apple[2] print(apple, pear, peach, "INSIDE FUNCTION") # End of FinalExamFunction main() #End of Final Exam Program
What is the output of the program below? (Note: This program works as expected)
#*************************************
# Final Exam
#*************************************
pear = 7
peach = 8
#*************************************
# Function: main
#*************************************
def main():
banana = [1, 2, 3, 4, 5]
print(banana, pear, peach, "BEFORE FUNCTION")
FinalExamFunction(banana)
print(banana, pear, peach, "AFTER FUNCTION")
# End of the Main Function
#*************************************
# Function: FinalExamFunction
#*************************************
def FinalExamFunction(apple):
global pear
pear = apple[0]
apple[0] = apple[4]
apple[4] = pear
peach = apple[2]
print(apple, pear, peach, "INSIDE FUNCTION")
# End of FinalExamFunction
main()
#End of Final Exam Program

Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images








