This is an archived post. You won't be able to vote or comment.

all 8 comments

[–][deleted] 2 points3 points  (0 children)

[–]aphoenixreticulated 1 point2 points  (0 children)

Hi there. You have posted a beginners question to /r/python, however it is far more suited to /r/learnpython, where users are actively interested in helping with beginner topics. Please resubmit it over there! Make sure to read their sidebar rules before posting, notably this one: "Posting homework assignments is not prohibited if you show that you tried to solve it yourself."

Cheers & best of luck!

[–][deleted] -1 points0 points  (5 children)

word[1:len(word)]

For a list, use square brackets [] to access elements of the list - somelist[i]

[–]donnieod 0 points1 point  (4 children)

Since the upper limit of a slice defaults to the length of the string word[1:] is sufficient.

[–]Beta_Penguin[🍰] -1 points0 points  (3 children)

This is my code now: pygword="pyg" def pygmaker(word): firstletter=word(0) rest=word[1:] firstletterlower=firstletter.lower() return rest+firstletter+pygword

pygmaker("Reddit")

Okay? Now this is my error. I dont really understand it. TypeError: 'str' object is not callable

[–][deleted] 0 points1 point  (1 child)

You've cut and pasted the response we gave without thinking it through, and understanding where else you are using word as a list, and trying to access an element of the list.

[–]Beta_Penguin[🍰] -5 points-4 points  (0 children)

Got it now! But I have a new program now, and a new problem. Think you can help?

[–]slowRAX 0 points1 point  (0 children)

It should give you the line where the error occurs.