Answer the question
In order to leave comments, you need to log in
Explain the structure of the code. Why is that?
Good afternoon. I hope you help me. I just can’t understand some points in Python, apparently I’m dumb, so I really count on your help, dear community. The fact is that I cannot understand why when calling class methods, in some cases ( ) brackets are put, but in some cases they are not. An example print(sys.version)
at the same time print(time.time( ))
The fact is that I was looking for an error in this banal example for 20 minutes, since in my version of the program it was written print(sys.version( ))
Please explain the moments with brackets.
Many thanks in advance to everyone!
Answer the question
In order to leave comments, you need to log in
class Class:
def __init__(self):
self.value = 1
def method(self):
return 'something'
c = Class()
print(c.value) # 1
print(c.method()) # something
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question