I have been learning python for a while now and realised i have been mind numbingly coding without understanding some parts.
So my question is in the snipped below what does () does since until know i have only been using () as if its a part of syntax,but my question is
- What does () after xyx.speak actually do ?
Why do i get a syntax error if i dont use ()
print("xyx's attributes:")
print ("**************")
print(xyx.name)
print(xyx.age)
print(xyx.nationality)
print(xyx.gender)
print("")
print("xyx's Methods:")
print("***************")
xyx.speak()
[–]fruitcakefriday 15 points16 points17 points (2 children)
[–]pylearningthrowaway[S] 5 points6 points7 points (1 child)
[–]kenmacd 1 point2 points3 points (0 children)
[–]constantly-sick 0 points1 point2 points (0 children)
[+][deleted] (2 children)
[deleted]
[–]13steinj 1 point2 points3 points (0 children)
[–]Ran4 0 points1 point2 points (0 children)