Learn
Strings & Console Output
String methods

Great work! Now that we know how to store strings, let’s see how we can change them using string methods.

String methods let you perform specific tasks for strings.

We’ll focus on four string methods:

  1. len()
  2. lower()
  3. upper()
  4. str()

Let’s start with len(), which gets the length (the number of characters) of a string!

Instructions

1.

On line 1, create a variable named parrot and set it to the string "Norwegian Blue".

On line 2, type len(parrot) after the word print, like so: print len(parrot). The output will be the number of characters in "Norwegian Blue"!

Folder Icon

Take this course for free

Already have an account?