If you want to return the neighbor's , consider this solution:
def get_nearest_less_element2(d, k):
dict_nearest = {value:key for key,value in d.items() if value >= float(k)}
nearest_index = min(dict_nearest)
nearest_value = dict_nearest[nearest_index]
return nearest_index, nearest_value
Moreover, with the following simple test you can check the equivalence of the results obtained from your old function and the new one:
d={1:11, 100:333, 40:44, 9:21, 4:99, 88:31, 7:77}
test_res = []
for k in range(0, 100, 5):
test_res.append(get_nearest_less_element(d,k) == get_nearest_less_element2(d,k)[0])
print(all(test_res))
# True