Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
4th Edition
ISBN: 9780134444321
Author: Tony Gaddis
Publisher: PEARSON
bartleby

Concept explainers

bartleby

Videos

Expert Solution & Answer
Book Icon
Chapter 10, Problem 5TF

Explanation of Solution

Hiding an attribute from outside the class:

  • • To hide a class’s attribute, start the name of attribute with two underscores in order to hide the code from the outside class.
  • • This helps in protecting the data from accidental corruption.
  • • The code outside the object does not have the necessity to know about the object’s data.

Example:

#define a class named example

class Example(object):

         #init method for the class

         def __init__(self):

              #assign value for the attribute

              self.a = 123

              #assign value for the attribute

              self._b = 123

              #assign value for the attribute

              self...

Blurred answer
01:48
Students have asked these similar questions
Need Java method please. Thank you.
Need Java method please. Thank you.
3. Write two nested loops to generate the following output. (Note: There is one space between each number, and any extra line shown is intentional.) 12 10 8 6 18 15 12 24 20 30 2 3 3 6 48 12 5 10 15 20 6 12 18 24 30

Chapter 10 Solutions

Starting Out with Python (4th Edition)

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
Indicate the actions to be ethical, unethical or unsure.

Thinking Like an Engineer: An Active Learning Approach (4th Edition)

The role of welding flux.

Degarmo's Materials And Processes In Manufacturing

It is the smallest part of the computer memory that can be changed in a single operation. It allows storage of ...

Computer Science: An Overview (13th Edition) (What's New in Computer Science)

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3); Author: CS Dojo;https://www.youtube.com/watch?v=8yjkWGRlUmY;License: Standard YouTube License, CC-BY