Strings and console output


#1



https://www.codecademy.com/courses/python-beginner-sRXwR/1/5?curriculum_id=4f89dab3d788890003000096

I
I have no idea how to complete this.


Replace this line with your code.


#2

ministry = "The Ministry of Silly Walks"

print len(ministry)
print ministry.upper()

First assign ministry to equal something.

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


#3

Ok then lets go through it step by step!

Step 1.) On line 3, call the len() function with the argument ministry.

So when we call the len we use the len function with the argument ministry in it. So len() with ministry so our argument goes inside the () so it should look like len(ministry).

Step 2.) On line 4, invoke the ministry's .upper() function.

So we are using dot notation to combine ministry with the .upper() function [otherwise known as the upper case function] So in dot notation you take the object you want and then combine it with a dot to the function you want to use. Therefore, it should resemble ministry.upper().

Now normally, this is correct fully. However, the lesson will give you an error if you follow this. It wants all of it printed out. So you have to print each individually like this for example:

print len(ministry)

#4

ministry = “The Ministry of Silly Walks”

print len(ministry)
print ministry.upper()

the variable is ministry which is is equal to the string "The Ministry Of Silly Walks"
you print it with len but with and argument of ministry (the argument is in the brackets)
then you make it upper case by typing .upper() after it.


#5

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