편집 기록

편집 기록
  • 프로필 nowp님의 편집
    날짜2021.05.17

    enter key 입력시 종료하는 프로그램 ValueError: could not convert string to float


        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:

  • 프로필 엽토군님의 편집
    날짜2021.05.17

    enter key 입력시 종료하는 프로그램


        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:

  • 프로필 알 수 없는 사용자님의 편집
    날짜2021.05.17

    enter key 입력시 종료하는 프로그램


    
    '''
    
        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: ''