Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Завдання: Механізм Доступу та Переваг Квитків | Взаємодія між різними типами даних
Типи Даних у Python

bookЗавдання: Механізм Доступу та Переваг Квитків

Завдання

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:

  1. age – convert age_str to an integer.
  2. has_id – normalize has_id_str and check if it equals "yes" (Boolean).
  3. Split ticket_code into tier, seat_number_str, and zone by slicing fixed positions.
  4. seat_number – convert seat_number_str to an integer.
  5. 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 and max_seat_number (inclusive).
    • entry_granted: can enter and seat is OK.
  6. Build summary using an f-string: "{tier}-{seat_number_str}-{zone} | age={age} | enter={entry_granted} | vip={vip_perk} | fastlane={member_fastlane}".

Рішення

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 4. Розділ 4
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

Suggested prompts:

Can you explain this in simpler terms?

What are the main benefits or drawbacks?

Can you give me a real-world example?

close

bookЗавдання: Механізм Доступу та Переваг Квитків

Свайпніть щоб показати меню

Завдання

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:

  1. age – convert age_str to an integer.
  2. has_id – normalize has_id_str and check if it equals "yes" (Boolean).
  3. Split ticket_code into tier, seat_number_str, and zone by slicing fixed positions.
  4. seat_number – convert seat_number_str to an integer.
  5. 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 and max_seat_number (inclusive).
    • entry_granted: can enter and seat is OK.
  6. Build summary using an f-string: "{tier}-{seat_number_str}-{zone} | age={age} | enter={entry_granted} | vip={vip_perk} | fastlane={member_fastlane}".

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 4. Розділ 4
single

single

some-alt