-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Expand file tree
/
Copy pathinterval.py
More file actions
30 lines (23 loc) · 865 Bytes
/
interval.py
File metadata and controls
30 lines (23 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""Prompt
Write a Google-style docstring for a function with the following signature:
def in_interval(number, start, end):
"""
# Output:
def in_interval(number, start, end):
"""
Checks if a given number is within a specified interval.
This function takes three arguments: a number, and the start
and end points of an interval.
It checks whether the given number falls within the specified
interval or not.
Args:
number (int or float): The number to check.
start (int or float): The starting point of the interval.
end (int or float): The ending point of the interval.
Returns:
bool: True if the given number falls within the interval,
False otherwise.
Raises:
ValueError: If the start is larger than the end, or if
the number, start, or end are not numbers.
"""