Question

Describe the difference between objects and values using the terms “equivalent” and “identical”. Illustrate the difference...

Describe the difference between objects and values using the terms “equivalent” and “identical”. Illustrate the difference using your own examples with Python lists and the “is” operator.  

Describe the relationship between objects, references, and aliasing. Again, create your own examples with Python lists.

Finally, create your own example of a function that modifies a list passed in as an argument. Describe what your function does in terms of arguments, parameters, objects, and references.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

(1) Differences between objects and value interms of identical and equivalent: Objects Value Objects nothing but instance of
looking like identical then check the equality of two variables. From the above outputs are secondList) >> print (firstList T
(2) Aliasing: Aliases act as pointers in some case and aliases are used in the case of lists and dictionaries. Alias can defiReferences: Reference is symbolic name representation of a python variable that reference to an object. Once object is create
Sample Output:

Objects:

>>> object1 = [1,2,3,4] >>>object1 [1, 2, 3, 4

References:

> object2 object1 >>

Aliasing:

>> object2 object1 > >>> object2 [1, 2, 3, 4 >>>print (id (object1)) 66211472 >> print (id (object2)) 66211472 >>

(3) argument Function that modifies a list passed is an class example Demo (): #Implementation of example method with argumen

Arguments The variable is declared at method declaration is called arguments. An argument is passed to a function, here from

Code Image:

class exampleDemo () #Implementation of example method #with argument as def test (self,listArgument): #Display statement pri

Sample Output:

Before modification of list [1, 2, 3, 4] After modification of list [5, 6, 7, 8]

Code to Copy:

class exampleDemo():

#Implementation of example method

#with argument as listArgument

def test(self,listArgument):

#Display statement

print("Before modification of list ",listArgument)

#assigning new values

listArgument[:] = [5,6,7,8]

#Display statement

print("After modification of list ",listArgument)

  

#creation of an object for exampleDemo class

object1 = exampleDemo()

#Declare listArgument as list type

#and assign values

arg1 = [1,2,3,4]

#call example method with parameter type

#listArgument

object1.test(arg1)

Add a comment
Know the answer?
Add Answer to:
Describe the difference between objects and values using the terms “equivalent” and “identical”. Illustrate the difference...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Generics Program In the following problem you will illustrate how we determine the greatest of 3...

    Generics Program In the following problem you will illustrate how we determine the greatest of 3 arguments using a single Generic method. You'll want to restrict the kinds of types that are allowed to be passed to Comparable objects. Create a GUI application which tests a method called maximum by calling the method 3 times; first with 3 ints, then with 3 doubles, and finally with 3 string objects as parameters. Your method maximum will determine the greatest of the...

  • In your own words, describe the difference between Between-Treatments (Groups) and Within-Treatments (Groups) variation. Explain how...

    In your own words, describe the difference between Between-Treatments (Groups) and Within-Treatments (Groups) variation. Explain how you would evaluate the variation and other methods to ensure that the data are appropriate to use for the test. Illustrate your ideas using a specific example. In replies to peers, provide additional examples to support the ideas presented.

  • Difficult Calculus Question (Difference between continuous and differentiable functions)

    Illustrate the difference between a function being continuous and differentiable by presenting at least two functions that are continuous but not differentiable for at least one value of their domain. Do not use the examples in the lecture notes. Come up with your own examples by looking up Calculus textbooks, using your own imagination, or by finding interesting examples online.

  • describe the difference in terms of reliability between repairable and non repairable items. use examples to...

    describe the difference in terms of reliability between repairable and non repairable items. use examples to further explain your answers.

  • Deletion of List Elements The del statement removes an element or slice from a list by position....

    Deletion of List Elements The del statement removes an element or slice from a list by position. The list method list.remove(item) removes an element from a list by it value (deletes the first occurance of item) For example: a = ['one', 'two', 'three'] del a[1] for s in a: print(s) b = ['a', 'b', 'c', 'd', 'e', 'f', 'a', 'b'] del b[1:5] print(b) b.remove('a') print(b) # Output: ''' one three ['a', 'f', 'a', 'b'] ['f', 'a', 'b'] ''' Your textbook...

  • This program will use the Random class to generate random temperatures (integers) between some minimum (inclusive)...

    This program will use the Random class to generate random temperatures (integers) between some minimum (inclusive) and some maximum (inclusive) values. You will need to calculate the minimum and maximum given a starting temperature integer and a possible change in temperature integer. (1) Copy the following method stub into your Temperature Predictor class and complete it according to the specifications described in the header comments. * Generates a random temperature (int) within a range when given the current temperature *...

  • Question 1 (a) Describe the five IP addressing classes. Provide an example for each of classes...

    Question 1 (a) Describe the five IP addressing classes. Provide an example for each of classes in binary and dotted-decimal representation. (b) Show the conversion of each of the addresses. (c) Describe the function of the subnet address for each of the classes and how does it work. [20 Marks] Question 2 (a) Define message switching, circuit switching and packet switching. Draw a diagram for each method to show the difference between them. (b) Identify the samples of network environment...

  • Using Swift playground and / or the command line for macOS (open Xcode, create a new...

    Using Swift playground and / or the command line for macOS (open Xcode, create a new Xcode project, macOS, command line tool), practice the following exercises: Exercise: Swift Variables Declare 2 variables/constants with some random values and any name of your choice Considering these 2 variables, one as a value of PI and other as a radius of circle, find the area of circle Print the area of circle Declare a string variable explicitly with value “Northeastern”. Declare a string...

  • Help please with a Project in C++ In C++, many of the keyboard symbols that are used between two ...

    Help please with a Project in C++ In C++, many of the keyboard symbols that are used between two variables can be given a new meaning. This feature is called operator overloading and it is one of the most popular C++ features. Any class can choose to provide a new meaning to a keyboard symbol. Not every keyboard letter is re-definable in this way, but many of the ones we have encountered so far are like +, -, *, /,...

  • C++ OPTION A (Basic): Complex Numbers A complex number, c, is an ordered pair of real...

    C++ OPTION A (Basic): Complex Numbers A complex number, c, is an ordered pair of real numbers (doubles). For example, for any two real numbers, s and t, we can form the complex number: This is only part of what makes a complex number complex. Another important aspect is the definition of special rules for adding, multiplying, dividing, etc. these ordered pairs. Complex numbers are more than simply x-y coordinates because of these operations. Examples of complex numbers in this...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT