Is Count avaliable function using after def function?

Viewed 33

I'm trying to use count function in python but I'm not sure can I use count in def function look likes below code?

def something():
....

 
print(something().count('C'))

I've try it but it's not working

1 Answers

make something return a string, then use count

def something():
    return "Country"

print(something().count('C'))
Related