Method calls that are never stored

A student wants to tidy a name and then inspect it, and writes this program:


Python
name = "  ada lovelace  "
name.strip()
name.upper()
print(len(name), name.find("l"))


The string assigned to name has exactly two spaces at each end. What does the program print?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More String Slicing and Methods Questions: