Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

closed I wanted to make a project, but something is wrong.

+6 votes
asked Sep 18, 2022 by codenxn (1,350 points)
closed Sep 23, 2022 by Admin
Hi! I'm not new at python programming, but when I started to do a project, which asks for your name, and tells you, how many letters do your name has, It got a problem. Please check my code, (I forgot about python for 1 months, because i found java, and learned many things about it. I must've forgot about the len() method, i dont know why it doesn't works.)  https://onlinegdb.com/j3PprIxH5
closed with the note: solved

2 Answers

+1 vote
answered Sep 18, 2022 by Peter Minarik (86,040 points)
selected Sep 23, 2022 by Admin
 
Best answer

Try this:

print("Your name has " + str(len(name)) + " letters.")

The point is, that len() is a separate function, not a field of the string class.

commented Sep 19, 2022 by codenxn (1,350 points)
Oh my lord why didn't i thinked of that? Thank you so much!
commented Sep 19, 2022 by Peter Minarik (86,040 points)
You're welcome.

Keep on coding! :)
0 votes
answered Sep 19, 2022 by Aryan Jain (140 points)
you have used len function wrong.

you have to give 8t in the form;

len(name)

solution is in the below link;

https://onlinegdb.com/htY7o9jC0
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...