Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele Challenge: Access & Ticket Perks Engine | Bring It All Together
Data Types in Python

bookChallenge: Access & Ticket Perks Engine

Tehtävä

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:

  1. age - convert age_str to an integer.

  2. has_id - convert has_id_str to a Boolean by normalizing text and comparing to "yes".

  3. Parse ticket_code into tier, seat_number_str, zone using slicing by fixed positions.

  4. seat_number - convert seat_number_str to an integer.

  5. Rules

    • is_adult: age is at least adult_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 to max_seat_number using a chained comparison.
    • entry_granted: can_enter and seat_ok.
  6. summary - f-string: "{tier}-{seat_number_str}-{zone} | age={age} | enter={entry_granted} | vip={vip_perk} | fastlane={member_fastlane}".

Ratkaisu

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 5. Luku 1
single

single

Kysy tekoälyä

expand

Kysy tekoälyä

ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

close

Awesome!

Completion rate improved to 5

bookChallenge: Access & Ticket Perks Engine

Pyyhkäise näyttääksesi valikon

Tehtävä

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:

  1. age - convert age_str to an integer.

  2. has_id - convert has_id_str to a Boolean by normalizing text and comparing to "yes".

  3. Parse ticket_code into tier, seat_number_str, zone using slicing by fixed positions.

  4. seat_number - convert seat_number_str to an integer.

  5. Rules

    • is_adult: age is at least adult_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 to max_seat_number using a chained comparison.
    • entry_granted: can_enter and seat_ok.
  6. summary - f-string: "{tier}-{seat_number_str}-{zone} | age={age} | enter={entry_granted} | vip={vip_perk} | fastlane={member_fastlane}".

Ratkaisu

Switch to desktopVaihda työpöytään todellista harjoitusta vartenJatka siitä, missä olet käyttämällä jotakin alla olevista vaihtoehdoista
Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

close

Awesome!

Completion rate improved to 5
Osio 5. Luku 1
single

single

some-alt