AttributeError: 'float' object has no attribute 'round'

유비빅·2023년 1월 18일
0

roundPython "AttributeError: 'float' object has no attribute 'round'" 는
float 숫자에서 함수 를 호출하려고 할 때 발생
오류를 해결하려면 float를 round()함수의 인수로 전달해야한다.

jupyter notebook을 이용하다가

example = 3.6
result = example.round()

연산 한 값에 float값이 있을 경우 위 에러를 발생시켰다
round()함수의 인수로 전달하는 방식으로 변경하니 막힘없이 진행 되는 것을 확인할 수 있었다.

example = 3.6
result = round(example)

0개의 댓글