๋ชฉ์ฐจ
[python] float ๊ฐ์ด ์ ์์ธ์ง ํ์ธํ๋ ๋ฐฉ๋ฒ - ๋ฆฌ๋ทฐ๋๋ผ
์ ์, ์ฆ 12,000๋ณด๋ค ์์ ๊ฐ์ฅ ํฐ ํ๋ธ ๋ฃจํธ๋ฅผ ์ฐพ์ผ๋ ค๊ณ ํฉ๋๋ค. processing = True n = 12000 while processing: n -= 1 if n ** (1/3) == #checks to see if this has decimals or not ์ ์์ธ์ง ์๋์ง ํ์ธํ๋ ๋ฐฉ๋ฒ์ ์ ๋ชจ๋ฅด๊ฒ
daplus.net
def button_plus_minus_clicked(self):
operation_solution=self.operation_solution.text()
if float(operation_solution) >0:
if float(operation_solution).is_integer:
operation_solution =int(operation_solution)*(-1)
else:
operation_solution =float(operation_solution)*(-1)
else:
if float(operation_solution).is_integer:
operation_solution =int(operation_solution)*(-1)
else:
operation_solution=float(operation_solution)*(-1)
self.operation_solution.setText(str(operation_solution))
(์).is_interger์ ํตํด์ ์ ์์ธ์ง ์ค์์ธ์ง ํ์ธํ ์ ์๋ค.
728x90
'2022 > ์คํ์์ค ์ํํธ์จ์ด ํ๋ก์ ํธ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
= ๋ฒํผ ์ด๋ฒคํธ (1) | 2022.11.27 |
---|---|
. ๋ฒํผ ๊ธฐ๋ฅ ์ถ๊ฐ ์์ (0) | 2022.11.27 |
UI ์์ ํ๊ธฐ (0) | 2022.11.23 |
QGridLayout (0) | 2022.11.23 |
GUI ๊ฐ์ 5 (0) | 2022.11.23 |