Challenge: Slicing and Search Drills
Aufgabe
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:
name_clean
: trim leading/trailing spaces fromfull_name
.has_quick
:True
if"quick"
appears anywhere insentence
(case-insensitive).inside_parens
: the substring inside the first pair of parentheses insentence
.o_count
: how many times the letter'o'
appears insentence
(case-insensitive).id_prefix
,id_number
,id_suffix
: fromid_code = "USR-00042-xy"
extract"USR"
,"00042"
, and"xy"
via slicing.domain
: fromemail
, after trimming and lowercasing, take everything after@
.report
: build"{name_clean} | {domain} | {id_number} | {o_count}"
using an f-string and the providedSEP
.
Lösung
War alles klar?
Danke für Ihr Feedback!
Abschnitt 3. Kapitel 6
single
Fragen Sie AI
Fragen Sie AI
Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen
Suggested prompts:
Can you explain this in simpler terms?
What are the next steps I should take?
Can you give me an example?
Awesome!
Completion rate improved to 5
Challenge: Slicing and Search Drills
Swipe um das Menü anzuzeigen
Aufgabe
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:
name_clean
: trim leading/trailing spaces fromfull_name
.has_quick
:True
if"quick"
appears anywhere insentence
(case-insensitive).inside_parens
: the substring inside the first pair of parentheses insentence
.o_count
: how many times the letter'o'
appears insentence
(case-insensitive).id_prefix
,id_number
,id_suffix
: fromid_code = "USR-00042-xy"
extract"USR"
,"00042"
, and"xy"
via slicing.domain
: fromemail
, after trimming and lowercasing, take everything after@
.report
: build"{name_clean} | {domain} | {id_number} | {o_count}"
using an f-string and the providedSEP
.
Lösung
War alles klar?
Danke für Ihr Feedback!
Awesome!
Completion rate improved to 5Abschnitt 3. Kapitel 6
single