Stuck with a code


#1

Good day everyone!

I am very new to programming and have no previous experience at all. I am currently stuck on an exercise where it is asking me to print the length and upper case of my string, and this is what I did:

I tried to use just .upper() which it worked, but I think I am doing something wrong with .len()
I thought maybe the ! was the problem but that doesn’t seem to be the case.

Thanks in advance!

Please leave the following link in the post so we can find the unit module, else replace it with a link to the exact lesson:

Strings and Console Output


#2

len() is a built-in function, so it should be len("string you want the length of"), this is different from .upper(), which is a string method


#3

Thank you for the quick response!
So just to clarify, if I use .len() I will have to put the entire string in there instead of a variable?


#4

len() has no full-stop, its not a method

no, you can also put a variable containing a string, but there had to be something left for you to figure out :wink:


#5

Ok! Thanks a lot! :smiley:


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.