enter key 입력시 종료하는 프로그램 ValueError: could not convert string to float
조회수 1146회
total=0
def readAndTotal():
global total
num=float(input('Enter a number'))
if num !='':
total+=num
return readAndTotal()
else:
return total
total = readAndTotal()
print("The total of all those values is", total)
엔터키를 누르기 전입력값들의 합을 출력하는 프로그램입니다. 이 코드를 작동시켜보면 str값을 float값으로 convert할 수 없다고 나옵니다. 어느부분이 문제인건가요?
ValueError: could not convert string to float:
-
(•́ ✖ •̀)
알 수 없는 사용자 - 〉
댓글 입력