Skip to content

Instantly share code, notes, and snippets.

@JohnsonLuu
Last active May 28, 2020 22:45
Show Gist options
  • Save JohnsonLuu/8fc53530b3a0b65e1180bf1ebc387120 to your computer and use it in GitHub Desktop.
Save JohnsonLuu/8fc53530b3a0b65e1180bf1ebc387120 to your computer and use it in GitHub Desktop.
"""
Create a function named in_range() that has three parameters named num, lower, and upper.
The function should return True if num is greater than or equal to lower and less than or equal to upper. Otherwise, return False.
"""
# Write your in_range function here:
def in_range(num, lower, upper):
if (num >= lower and num <= upper):
return True
else:
return False
# Uncomment these function calls to test your in_range function:
print(in_range(10, 10, 10))
# should print True
print(in_range(5, 10, 20))
# should print False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment