A
A
Andrey Godunko2021-12-15 22:30:24
Python
Andrey Godunko, 2021-12-15 22:30:24

How to implement a check of numbers for proximity?

I need to make sure that each number in the list num is divided by the last number in the list, and then the smallest result is displayed. I tried to implement it but I didn't succeed. Here is my attempt:

num = [10, 2, 8, -7, 3, 7]
rang = len(num) - 1

point = num[5]
del num[5]

way = []
for i in range(rang):
    h = point  / num.*
    way.extend(h)

print(min(way))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Pankov, 2021-12-15
@Noy-name-boy

min(x/num[-1] for x in num[:-1])
But what did you want to achieve. I still don't understand:num.*

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question