💻 프로그래밍/Python

[파이썬] TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'

gameuiux 2024. 5. 26. 04:29
728x90
반응형

TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'

a = input("값을 입력하세요:")
b = input("값을 입력하세요:")

print(a ** 2 + b )

 

오류

TypeError
: unsupported operand type(s) for ** or pow(): 'str' and 'int'

 

 

데이터 타입 변환

a = int(input("값을 입력하세요:"))
b = float(input("값을 입력하세요:"))

print(a ** 2 + b )

 

결과

값을 입력하세요:1
값을 입력하세요:1.1
2.1
728x90
반응형