Python beginner's question

Asked 2 years ago, Updated 2 years ago, 64 views

What I have to do is I got Jessica = Necklace ('Jessica') When ordered to execute Jessica, Necklace ('Jessica') I have to give it out as an output, but the rest of the prints and len work well, but when I run Jessica, it continues to be printed only as 'Jessica', so I can't solve it. I've tried the Python console, but I can't find the problem.


def Necklace(self):
       return self

Jessica = Necklace('Jessica')
Jessica
print(Jessica)
len(Jessica)

pycharm

2022-09-20 10:55

1 Answers

def Necklace(self):
    return self

Jessica = Necklace('Jessica')
print(Jessica) # Jessica

Jessica = Necklace
print(Jessica('Jessica')) # Jessica

Jessica = "Necklace('Jessica')"
print(Jessica) # Necklace('Jessica')

I don't know what you want 😢


2022-09-20 10:55

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.