string = 'ABcD'
for letter in string:
if letter.isupper():
print (letter,end='')
In the above code, the output is ABD
But when I write the code without parentheses after isupper
, like so:
string = 'ABcD'
for letter in string:
if letter.isupper:
print (letter,end='')
the output is ABcD
.
Why doesn't python raise a syntax error here ; how does this work?