Python strings start at position 0, but Cambridge pseudocode starts at 1. You will write a Python version of SUBSTRING that counts from 1, and use it to count letters.
Your tasks.
substring(text, start, length) returns length characters starting at position start, where the first character is position 1.count_letter(text, letter) returns how many times letter appears, in upper or lower case. Use a loop and your substring.initials to the first letters of the two words in name, for example "AL" for "Ada Lovelace".Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…