Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Find Words Starting with a Specific Letter | Introduction to Regular Expressions
Python Regular Expressions

bookChallenge: Find Words Starting with a Specific Letter

You will write a function that extracts all words starting with the uppercase letter 'A' from a given string. This exercise will help you practice using basic regular expression patterns and Python's re module. Only words beginning with a capital 'A' should be matched—the search must be case-sensitive.

Key Points:

  • Use Python's re module;
  • Match only words that start with uppercase 'A';
  • Preserve the original form of each matched word from the text.
Oppgave

Swipe to start coding

Write a function to extract all words that start with the uppercase letter A from a given string using regular expressions. Only words beginning with a capital A should be included in the result. The search is case-sensitive. Return the words exactly as they appear in the input text.

Løsning

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 3
single

single

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

Suggested prompts:

Can you show me an example input and expected output?

What should the function return if there are no matching words?

Should punctuation attached to words be included or ignored?

close

Awesome!

Completion rate improved to 6.67

bookChallenge: Find Words Starting with a Specific Letter

Sveip for å vise menyen

You will write a function that extracts all words starting with the uppercase letter 'A' from a given string. This exercise will help you practice using basic regular expression patterns and Python's re module. Only words beginning with a capital 'A' should be matched—the search must be case-sensitive.

Key Points:

  • Use Python's re module;
  • Match only words that start with uppercase 'A';
  • Preserve the original form of each matched word from the text.
Oppgave

Swipe to start coding

Write a function to extract all words that start with the uppercase letter A from a given string using regular expressions. Only words beginning with a capital A should be included in the result. The search is case-sensitive. Return the words exactly as they appear in the input text.

Løsning

Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 3
single

single

some-alt