I need help about Dot Notation


#1

I tried everything but nothing..


#2

please post your formatted code


#3

ministry = "The Ministry of Silly Walks"

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

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


#4

Ok there is just a little bit of confusion going on here.

Print is a stand alone function. It prints what ever follows it. dot notation is only used for string modulation.
The len function takes in a value and returns the number of spaces/chars in it(it does not modify the string so dot notation is not appropriate). So your first problem would be resolved with

print len(ministry)

The second issue is about the upper function. This function returns the string but in all caps aka it does string modulation and uses dot notation. Once again we call print on its own. We are looking to modify the string contained in the variable "ministry" with the upper() function so we do

print ministry.upper()

You do not need to add the contents of ministry in quotes like that. We already have it stored in a varaible, and retyping it kind of defeats the purpose of variables in the first place.


#5

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