Light Mode
Dark Mode
Problem Nearest Value

Why not cheking?

def nearestvalue(values: set, one: int) -> int: cheklist = [abs(one - el) for el in values] resultindex, result = cheklist.index(min(cheklist)), list(values) return result[resultindex]

if name == 'main': print("Example:") assert nearest_value({-1, 2, 3}, 0) == -1 print("Coding complete? Click 'Check' to earn cool rewards!")

  • bug
  • code_review
  • python
Created: April 20, 2020, 4:33 p.m.
Updated: April 20, 2020, 5 p.m.
0
10
User avatar
anton.izofatov