Challenge: Working with Logical Operators
Opgave
Swipe to start coding
You are managing an admission system for an amusement park. The park has a rule that only adults (18 years or older) or children accompanied by adults are allowed to enter. You have four people: Bob, Alice, John, and Mike.
- Use comparison operators and logical operators to determine if the admission criteria are met.
- Check if Bob and John can enter the park together. Store the result in the variable
can_bob_and_john_enter
. - Check if Alice OR Mike can enter the park individually. Store the result in the variable
can_alice_or_mike_enter
. - Check if Bob, Alice, and John can all enter the park together. Store the result in the variable
can_bob_alice_john_enter
.
Løsning
Var alt klart?
Tak for dine kommentarer!
Sektion 3. Kapitel 4
single
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat
Awesome!
Completion rate improved to 1.67
Challenge: Working with Logical Operators
Stryg for at vise menuen
Opgave
Swipe to start coding
You are managing an admission system for an amusement park. The park has a rule that only adults (18 years or older) or children accompanied by adults are allowed to enter. You have four people: Bob, Alice, John, and Mike.
- Use comparison operators and logical operators to determine if the admission criteria are met.
- Check if Bob and John can enter the park together. Store the result in the variable
can_bob_and_john_enter
. - Check if Alice OR Mike can enter the park individually. Store the result in the variable
can_alice_or_mike_enter
. - Check if Bob, Alice, and John can all enter the park together. Store the result in the variable
can_bob_alice_john_enter
.
Løsning
Var alt klart?
Tak for dine kommentarer!
Awesome!
Completion rate improved to 1.67Sektion 3. Kapitel 4
single