Can someone help me on Dot notation plz?


#1


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.len(ministry)
print ministry.upper()


#2

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"
len(lion)
lion.upper()
Methods that use dot notation only work with strings.

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

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


#3

Hi here

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

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


#4

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


#5

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.


#6

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.


#7

I need help how do you do dot notation?