Menu

Sign in to track your progress and unlock all features.

Theme style

Log in

Full lesson preview

Use Boolean Values

Learn how to produce and return boolean values using comparisons. Practice writing a simple condition that yields True or False.

Python practice6 minVariables & Data TypesBeginnerLast updated December 29, 2025

Problem statement

Write a function is_adult(age) that returns True if the given age is 18 or older, and False otherwise. Use a comparison expression to produce the boolean value directly.

Task

Implement a function that returns a boolean based on a numeric comparison (is age an adult?).

Examples

Example - under 18

Input

is_adult(16)

Output

False

16 is less than 18, so the function returns False.

Example - exactly 18

Input

is_adult(18)

Output

True

Age 18 meets the threshold for being an adult, so the function returns True.

Input format

A single integer parameter: age (e.g., 17).

Output format

A boolean value: True or False.

Constraints

age is an integer between -1000 and 1000 (may be negative in edge cases).

Samples

Sample 1

Input

is_adult(20)

Output

True

20 is >= 18, so return True.