Python с плавающей точкой в преобразовании int

Error: User Rate Limit Exceededint(20.0)Error: User Rate Limit Exceeded20Error: User Rate Limit Exceeded

levels = [int(gex_dict[i]) for i in sorted(gex_dict.keys())]

Error: User Rate Limit Exceededgex_dict[i]Error: User Rate Limit Exceeded20.0Error: User Rate Limit Exceeded

"invalid literal for int() with base 10: '20.0'"

Error: User Rate Limit Exceeded

Ответы на вопрос(4)

Error: User Rate Limit Exceededgex_dict[i]Error: User Rate Limit Exceeded'20.0'Error: User Rate Limit Exceeded

Error: User Rate Limit ExceededError: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

>>> int(20.0)
20
>>> int('20.0')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: '20.0'

Error: User Rate Limit Exceeded

>>> int(float('20.0'))
20

Error: User Rate Limit Exceeded

levels = [int(float(gex_dict[i])) for i in sorted(gex_dict.keys())]

Error: User Rate Limit Exceededint(float(gex_dict[i]))

Решение Вопроса

'20.0'Error: User Rate Limit ExceededfloatError: User Rate Limit ExceededintError: User Rate Limit ExceededfloatError: User Rate Limit Exceededint:

>>> int(float('20.0'))
20

Error: User Rate Limit Exceeded

Ваш ответ на вопрос