Challenge: Access & Ticket Perks Engine
Swipe to start coding
Fill in the expressions using only variables, basic operators, and the tools we covered: strip
, casefold
, int
, slicing, comparisons, and logical operators.
Compute:
-
age
- convertage_str
to an integer. -
has_id
- converthas_id_str
to a Boolean by normalizing text and comparing to"yes"
. -
Parse
ticket_code
intotier
,seat_number_str
,zone
using slicing by fixed positions. -
seat_number
- convertseat_number_str
to an integer. -
Rules
is_adult
:age
is at leastadult_age
.can_enter
: must have ID and be an adult.vip_perk
: tier is"VIP"
.member_fastlane
: user is a member and can enter.seat_ok
:seat_number
is in the inclusive range from 1 tomax_seat_number
using a chained comparison.entry_granted
:can_enter
andseat_ok
.
-
summary
- f-string:"{tier}-{seat_number_str}-{zone} | age={age} | enter={entry_granted} | vip={vip_perk} | fastlane={member_fastlane}"
.
Oplossing
Bedankt voor je feedback!
single
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.
Awesome!
Completion rate improved to 5
Challenge: Access & Ticket Perks Engine
Veeg om het menu te tonen
Swipe to start coding
Fill in the expressions using only variables, basic operators, and the tools we covered: strip
, casefold
, int
, slicing, comparisons, and logical operators.
Compute:
-
age
- convertage_str
to an integer. -
has_id
- converthas_id_str
to a Boolean by normalizing text and comparing to"yes"
. -
Parse
ticket_code
intotier
,seat_number_str
,zone
using slicing by fixed positions. -
seat_number
- convertseat_number_str
to an integer. -
Rules
is_adult
:age
is at leastadult_age
.can_enter
: must have ID and be an adult.vip_perk
: tier is"VIP"
.member_fastlane
: user is a member and can enter.seat_ok
:seat_number
is in the inclusive range from 1 tomax_seat_number
using a chained comparison.entry_granted
:can_enter
andseat_ok
.
-
summary
- f-string:"{tier}-{seat_number_str}-{zone} | age={age} | enter={entry_granted} | vip={vip_perk} | fastlane={member_fastlane}"
.
Oplossing
Bedankt voor je feedback!
Awesome!
Completion rate improved to 5single