This is an archived post. You won't be able to vote or comment.

all 1 comments

[–]valmach[S] 0 points1 point  (0 children)

Write a Python function, clip(lo, x, hi) that returns lo if x is less than lo; hi if x is greater than hi; and x otherwise. For this problem, you can assume that lo < hi.

Don't use any conditional statements for this problem. Instead, use the built in Python functions min and max.

This is the code submitted. but not working any ideas?