Can someone help me on Dot notation plz?

<Below this line, add a link to the exact exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>

<What do you expect to happen instead?>


Replace this line with your code. Do not remove the backticks that are above or below this line.
ministry.upper() = “The Ministry of Silly Walks”

print ministry.upper()

<do not remove the three backticks above>

This is what it tell’s me to do.

Dot Notation
Let’s take a closer look at why you use len(string) and str(object), but dot notation (such as “String”.upper()) for the rest.

lion = “roar”
Methods that use dot notation only work with strings.

On the other hand, len() and str() can work on other data types.

On line 3, call the len() function with the argument ministry.
On line 4, invoke the ministry’s .upper() function.

Hi here

ministry.upper() = "The Ministry of Silly Walks"

You didn’t wrote the variable ministry but ministry.upper()

Oh ok thx man, thx for the help, have fun coding.

Hi All,

In the example shared by thehomelesscanadian the difference that has been specified is that len() works on all data types and Methods that use dot notation works only with strings.
In case of str() it works with all data types since it changes non string values to string values.
but in case of len() if we use len(221) or any int value inside len method then it throws an error message.
Traceback (most recent call last):
** File “python”, line 2, in **
TypeError: object of type ‘int’ has no len()
according to the instructions given that len()( works on all data types), it is violating it.

Can anybody please help me in understanding this.

Considering this is a resolved post I don’t think you’ll get a response quickly, I suggest you make a new topic addressing that.

I need help how do you do dot notation?