Bike-share unlock conditions

A bike-share app decides whether to offer a ride using these Python variables for one customer:


Python
battery = 42        # battery charge, percent
distance_km = 6.5   # planned trip length
has_pass = False    # customer holds a monthly pass


Evaluate each expression below with these values. Enter true or false for each one.

  • Expression A: battery >= 40 and distance_km < 5
  • Expression B: not has_pass or battery > 80
  • Expression C: battery > 40 or distance_km < 5 and has_pass
  • Expression D: (battery > 40 or distance_km < 5) and has_pass
Your answers

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Boolean Expressions Questions: