Challenge: Access & Ticket Perks Engine
Task
Swipe to start coding
Use only variables, operators, and the tools we covered β
strip, casefold, int, slicing, comparisons, and logical operators β to complete each expression.
Compute:
ageβ convertage_strto an integer.has_idβ normalizehas_id_strand check if it equals"yes"(Boolean).- Split
ticket_codeintotier,seat_number_str, andzoneby slicing fixed positions. seat_numberβ convertseat_number_strto an integer.- Rules:
is_adult:age >= adult_age.can_enter: must have ID and be adult.vip_perk:tier == "VIP".member_fastlane: user is a member and can enter.seat_ok: seat number between 1 andmax_seat_number(inclusive).entry_granted: can enter and seat is OK.
- Build
summaryusing an f-string:"{tier}-{seat_number_str}-{zone} | age={age} | enter={entry_granted} | vip={vip_perk} | fastlane={member_fastlane}".
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 4. ChapterΒ 4
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 3.45
Challenge: Access & Ticket Perks Engine
Swipe to show menu
Task
Swipe to start coding
Use only variables, operators, and the tools we covered β
strip, casefold, int, slicing, comparisons, and logical operators β to complete each expression.
Compute:
ageβ convertage_strto an integer.has_idβ normalizehas_id_strand check if it equals"yes"(Boolean).- Split
ticket_codeintotier,seat_number_str, andzoneby slicing fixed positions. seat_numberβ convertseat_number_strto an integer.- Rules:
is_adult:age >= adult_age.can_enter: must have ID and be adult.vip_perk:tier == "VIP".member_fastlane: user is a member and can enter.seat_ok: seat number between 1 andmax_seat_number(inclusive).entry_granted: can enter and seat is OK.
- Build
summaryusing an f-string:"{tier}-{seat_number_str}-{zone} | age={age} | enter={entry_granted} | vip={vip_perk} | fastlane={member_fastlane}".
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 4. ChapterΒ 4
single