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}"
.
Lösung
Danke für Ihr Feedback!
single
Fragen Sie AI
Fragen Sie AI
Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen
Can you explain this in simpler terms?
What are the main points I should remember?
Can you give me an example?
Awesome!
Completion rate improved to 5
Challenge: Access & Ticket Perks Engine
Swipe um das Menü anzuzeigen
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}"
.
Lösung
Danke für Ihr Feedback!
Awesome!
Completion rate improved to 5single