Desafio: Mecanismo de Acesso e Benefícios de Ingresso
Tarefa
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}".
Solução
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 4. Capítulo 4
single
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Suggested prompts:
Can you explain this in simpler terms?
What are the main benefits or drawbacks?
Can you give me a real-world example?
Incrível!
Completion taxa melhorada para 3.45
Desafio: Mecanismo de Acesso e Benefícios de Ingresso
Deslize para mostrar o menu
Tarefa
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}".
Solução
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 4. Capítulo 4
single