logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Bimla RastogiResume writing
(5/5)

925 Answers

Hire Me
expert
Avinash KumaarData mining
(/5)

774 Answers

Hire Me
expert
Cecil BoazFinance
(5/5)

704 Answers

Hire Me
expert
Isaac TorressCriminology
(5/5)

597 Answers

Hire Me
R Programming
(5/5)

What is the difference between classes and instances? What is the difference between a function and a method

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

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?

(5/5)
Attachments:

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

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

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme