QUIZ_PYTHON Telegram 3969
Выводится тип объекта и его адрес в памяти, потому что в методе display() вы печатаете сам объект (self), а не его атрибут data.

Если добавить атрибут .data в вывод display, то выведется «Москва»:

class MyClass():
def setdata(self, value):
self.data = value
def display(self):
print(
self.data)

x = MyClass()
x.data = 'Москва'
x.display() # Москва



tgoop.com/quiz_python/3969
Create:
Last Update:

Выводится тип объекта и его адрес в памяти, потому что в методе display() вы печатаете сам объект (self), а не его атрибут data.

Если добавить атрибут .data в вывод display, то выведется «Москва»:

class MyClass():
def setdata(self, value):
self.data = value
def display(self):
print(
self.data)

x = MyClass()
x.data = 'Москва'
x.display() # Москва

BY Python: задачки и вопросы


Share with your friend now:
tgoop.com/quiz_python/3969

View MORE
Open in Telegram


Telegram News

Date: |

3How to create a Telegram channel? During a meeting with the president of the Supreme Electoral Court (TSE) on June 6, Telegram's Vice President Ilya Perekopsky announced the initiatives. According to the executive, Brazil is the first country in the world where Telegram is introducing the features, which could be expanded to other countries facing threats to democracy through the dissemination of false content. Telegram has announced a number of measures aiming to tackle the spread of disinformation through its platform in Brazil. These features are part of an agreement between the platform and the country's authorities ahead of the elections in October. Telegram offers a powerful toolset that allows businesses to create and manage channels, groups, and bots to broadcast messages, engage in conversations, and offer reliable customer support via bots. 2How to set up a Telegram channel? (A step-by-step tutorial)
from us


Telegram Python: задачки и вопросы
FROM American