FAQ: Learn Python – Strings & Console Output – Dot Notation

Community%20FAQs%20on%20Codecademy%20Python%20Exercises

This community-built FAQ covers the “Dot Notation” exercise in Codecademy’s lessons on Python.

FAQs for the Codecademy exercise Dot Notation:

Join the Discussion. We Want to Hear From You!

Have a new question or can answer someone else’s? Reply (reply) to an existing thread!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources about Python in general? Go here!

Want to take the conversation in a totally different direction? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account, billing, Pro, or Pro Intensive? Reach out to our support team!

None of the above? Find out where to ask other questions here!

Other FAQs

The following are links to additional questions that our community has asked about this exercise:

  • This list will contain other frequently asked questions that aren’t quite as popular as the ones above.
  • Currently there have not been enough questions asked and answered about this exercise to populate this FAQ section.
  • This FAQ is built and maintained by you, the Codecademy community – help yourself and other learners like you by contributing!

Not seeing your question? It may still have been asked before – try searching for it by clicking the spyglass icon (search) in the top-right of this page. Still can’t find it? Ask it below by hitting the reply button below this post (reply).

Hi Coursecademy. Its indeed a pleasure to write to a wonderful platform like this which has made coding for biologists and other non-computer core people much much easier. But now, I have a doubt on len() command. The dot notation is clear, but the length of a string containing more than one words is giving an output containing the number of letters as well as the number of spaces in between the words. This seems tricky. Will you please help me to rectify it? Thank you.

1 Like

why is this tricky?

What do you want the number (length) of? Only alphanumeric characters? Punctuation as well? The length of each individual word?

len is designed to get the total count of everything in the string.

1 Like

Just came across a glitch that may need some attention. I went to this page, and when I got to the part to do the script.py, information from another script.py was in the coding area. Therefore, I was not able to follow the directions, because the directions were based on having specific information pre-loaded to the script.py. Since this was different than what it was supposed to be, I could not get the correct answer. However, I was able to make it pop up right by going back to the previous page before Dot Notation, and then going back to the Dot Notation page. Then, the information that was supposed to originally be in the script.py was there. Thanks

I equally find this tricky and i think it’s because even though the len command is designed to count every character of the string, it output still fall short of what is obtainable. take for instance this "The Ministry of Silly Walks"
the len comman returned 27 on the console and it to be 25 i think

The Ministry of Silly Walks is 27 in length, why should this be 25? Even if you use a tool like this one, you will get 27. There really are 27 characters in this string

1 Like

thanks. you’re actually correct as I have checked again, the characters are 27 and not 25

The reference to Monty Pythons’s Silly Walks sketch is funny. Both are python (fun fact: the creator of Python named Python after Monty Python.)

Could I get a fact-check on this?

I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python’s Flying Circus).

Is this course outdated?
I have copied the code in powershell and got an error.

[codebyte]

[/codebyte]ministry = “The Ministry of Silly Walks”

print len(ministry)
print ministry.upper()

[codebyte]

At line:4 char:22

  • print ministry.upper()
  •                  ~
    

An expression was expected after ‘(’.
+ CategoryInfo : ParserError: (:slight_smile: , ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ExpectedExpression