1) Functions can calculate, return, store, and display values. New programmers are sometimes confused by the distinction. Consider this program:
def sum1(a, b, result):
the_sum = a + b
def sum2(a, b, result):
the_sum = a + b
print(the_sum)
def sum3(a, b, result):
the_sum = a + b
result.append(the_sum)
def sum4(a, b, result):
the_sum = a + b
return the_sum
def sum5(a, b, result):
the_sum = a + b
print(the_sum)
result.append(the_sum)
return the_sum
a_list = []
print('sum1 returns', sum1(1, 2, a_list))
print('a_list now', a_list)
print('sum2 returns', sum2(1, 2, a_list))
print('a_list now', a_list)
print('sum3 returns', sum3(1, 2, a_list))
print('a_list now', a_list)
print('sum4 returns', sum4(1, 2, a_list))
print('a_list now', a_list)
print('sum5 returns', sum5(1, 2, a_list))
print('a_list now', a_list)
Here is an example run:
After calculating the sum...
• sum1 discards it.
• sum2 prints it, but does not store or return it.
• sum3 stores it, but does not print or return it.
• sum4 returns it, but does not print or store it.
• sum5 prints it, stores it, and returns it.
Walk through the program and explain to yourself why the output above looks like it does. Then provide an example use scenario for each of the patterns of sum2, sum3, and sum 4, i.e. when you would want a function to display, store, or return a calculated value.
2) What is the difference between classes and instances? What is the difference between a function and a method?
3) Testing software is an important part of software development. Web search "python test framework comparison". Compare and contrast at least three Python test frameworks. Which would you choose? Why?
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme