편집 기록

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

    파이썬 'int' object has no attribute 'isdigit'


    score = int(input("Enter your score: "))
    
    if not score < 0:
        if score.isdigit():
            if score > 100 and score < 0:
                grade = '0~100사이'
            else:
                grade = 'asd'
        else:
            grade = '숫자로 입력해주세요'
    else:
        grade = '음수는 입력이 불가'
    
    print(grade)
    
    • 에러1 음수
    • 에러2 숫자범위
    • 에러3 문자열불가 이렇게 만들려고 하는데

    'int' object has no attribute 'isdigit'

    라고 정수형 형태가 안맞는 에러가(?) 나와요. 어느부분에서 형태수정해야할지좀 알려주시와요.

  • 프로필 김성은님의 편집
    날짜2022.06.28

    어디서 틀렷는지 잘모르겟어요.. isdigit를 잘쓴것도 맞는지궁금합니다!


    score = int(input("Enter your score: "))

    if not score < 0: if score.isdigit(): if score > 100 and score < 0: grade = '0~100사이' else: grade = 'asd' else: grade = '숫자로 입력해주세요' else: grade = '음수는 입력이 불가'

    print(grade)

    에러1 음수 에러2 숫자범위 에러3 문자열불가 이렇게 만들려고 하는데 'int' object has no attribute 'isdigit' 라고 정수형.. 형태가 안맞는 에러가..? 나와요 어느부분에서 형태수정해야할지좀 알려주시와요 ㅜㅜ