Public
The public access type is a regular access modifier that we used in previous sections.
You should use the public access modifier for attributes/methods that can be used outside the class. Its public information can be used by other tools inside the code.
12345678910class SomeClass: attribute = "Public" def method(self): print("You can use it everywhere in your code") instance = SomeClass() print(instance.attribute) instance.method()
These attributes/methods are used to get information about the class or manipulate the class in code.
Takk for tilbakemeldingene dine!
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Awesome!
Completion rate improved to 2.78
Public
Sveip for å vise menyen
The public access type is a regular access modifier that we used in previous sections.
You should use the public access modifier for attributes/methods that can be used outside the class. Its public information can be used by other tools inside the code.
12345678910class SomeClass: attribute = "Public" def method(self): print("You can use it everywhere in your code") instance = SomeClass() print(instance.attribute) instance.method()
These attributes/methods are used to get information about the class or manipulate the class in code.
Takk for tilbakemeldingene dine!