강의

멘토링

로드맵

Inflearn Community Q&A

chch49340443's profile image
chch49340443

asked

Free Python Tutorial (Basic) - Become a Developer in 6 Hours

스타그래프트 관련 질문 드립니다.

Resolved

Written on

·

196

0

저는 탱크 공격력이 *= 2 연산이 안되고 35.0으로 출력이 됩니다.

왜 저는 연산이 안되고 실수로 출력이 될까요

python

Answer 1

1

nadocoding님의 프로필 이미지
nadocoding
Instructor

안녕하세요

출력부분에 int(self.damage) 이런 식으로 정수형으로 변환 해주면 되겠습니다 ^^

간단한 예제입니다.

class Tank:
    damage = 10.0
    def show(self):
        print("{0}".format(int(self.damage)))

Tank().show()

감사합니다.

chch49340443's profile image
chch49340443

asked

Ask a question