0
string_ = "hello world"
print("{0[1].capitalize()} {0[0].capitalize()}".format(string_.split(" ")))

with running this I get

AttributeError: 'str' object has no attribute 'capitalize()'

please tell me what's wrong because string method has capitalize method in it!

dir(string_)
Out[108]: 
[...
 'capitalize',
 ...]
WorldLover
  • 131
  • 1
  • 7

0 Answers0