Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele Challenge: Slicing and Search Drills | Strings
Data Types in Python

bookChallenge: Slicing and Search Drills

Tehtävä

Swipe to start coding

Fill in the expressions to compute each result using only the taught tools (string methods, slicing, in/find/count, and f-strings).

Compute:

  1. name_clean: trim leading/trailing spaces from full_name.
  2. has_quick: True if "quick" appears anywhere in sentence (case-insensitive).
  3. inside_parens: the substring inside the first pair of parentheses in sentence.
  4. o_count: how many times the letter 'o' appears in sentence (case-insensitive).
  5. id_prefix, id_number, id_suffix: from id_code = "USR-00042-xy" extract "USR", "00042", and "xy" via slicing.
  6. domain: from email, after trimming and lowercasing, take everything after @.
  7. report: build "{name_clean} | {domain} | {id_number} | {o_count}" using an f-string and the provided SEP.

Ratkaisu

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 3. Luku 6
single

single

Kysy tekoälyä

expand

Kysy tekoälyä

ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

Suggested prompts:

Can you explain this in simpler terms?

What are the next steps I should take?

Can you give me an example?

close

Awesome!

Completion rate improved to 5

bookChallenge: Slicing and Search Drills

Pyyhkäise näyttääksesi valikon

Tehtävä

Swipe to start coding

Fill in the expressions to compute each result using only the taught tools (string methods, slicing, in/find/count, and f-strings).

Compute:

  1. name_clean: trim leading/trailing spaces from full_name.
  2. has_quick: True if "quick" appears anywhere in sentence (case-insensitive).
  3. inside_parens: the substring inside the first pair of parentheses in sentence.
  4. o_count: how many times the letter 'o' appears in sentence (case-insensitive).
  5. id_prefix, id_number, id_suffix: from id_code = "USR-00042-xy" extract "USR", "00042", and "xy" via slicing.
  6. domain: from email, after trimming and lowercasing, take everything after @.
  7. report: build "{name_clean} | {domain} | {id_number} | {o_count}" using an f-string and the provided SEP.

Ratkaisu

Switch to desktopVaihda työpöytään todellista harjoitusta vartenJatka siitä, missä olet käyttämällä jotakin alla olevista vaihtoehdoista
Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

close

Awesome!

Completion rate improved to 5
Osio 3. Luku 6
single

single

some-alt