Question

Regarding Python 3: 16. Explain what happens when a program receives a non-numeric string when a...

Regarding Python 3:

16. Explain what happens when a program receives a non-numeric string when a number is expected as input, and explain how the try-except statement can be of use in this situation.

17. What is meant by the state of an object, and how does the programmer access and manipulate it?

18. Explain the differences between instance variables and temporary variables. Focus on their visibility in a class definition, and on their roles in managing data for an object of that class.

19. Explain the purpose of the variable self in a Python class definition.

Homework Answers

Answer #1

16) Here the code begins at 'try' block with a clause 'except' which handles these exceptions. When an exception occurs in a try block where the rest of the statement's execution gets skipped. If the exception get matches then the corresponding handler gets executed.

17) The states of an object are the instances which is a variable that contains. An object have state and behavior. A programmer access the data(state) and manipulate the code(behavior).

18) A non static variable is called as an instance variable whereas local variables are known for a temporary variable.The instance variables are visible on all parts of a code based on the access modifiers such as public, protected and private but the temporary variables are not visible outside the scope.

19) The self in python represents the instance of a class

Know the answer?
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
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT