Stack Overflow на русском Asked on August 30, 2021
Привести к целому и прибавить 0.5
x = int(x) + 0.5
Answered by Эникейщик on August 30, 2021
Через встроенный round()
x = round(x) - 0.5 if round(x) > x else round(x) + 0.5
Answered by icYFTL on August 30, 2021
Отбросить дробную часть и прибавить 0.5
:
import math
x = math.trunc(x)+0.5
Answered by becouse on August 30, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP