편집 기록

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

    파이썬 조건문에서 n과 N을 동시에 비교하기


    import random
    
    while True:
        name=input('당신의 이름은 무엇입니까?:')
        print(name,'님','안녕하세요?')
    
        dice=random.randint(1,6)
        if dice==1:
            print('ㅇ.')
        elif dice==2:
            print('ㄴ.')
        elif dice==3:
            print('ㄹ.')
        elif dice==4:
            print('ㅎ.')
        elif dice==5:
            print('ㄱ.')
        else:
            print('ㅂ.')
        print('감사합니다.')
    
        input('시스템을 중지하시겠습니까?')
    
        if answer=='Y'or'y':
            break
        elif answer=='N'or'n':
            continue
    
    

    이 코드 마지막 부분에서 꼭 'N'이나 'n'을 입력해야만 처음으로 돌아가게 하고 싶은데 continue말고 어떤걸 입력해야 하나요?

  • 프로필 왕초보님의 편집
    날짜2022.06.11

    파이썬 질문 드립니다


    import random
    
    while True:
        name=input('당신의 이름은 무엇입니까?:')
        print(name,'님','안녕하세요?')
    
        dice=random.randint(1,6)
        if dice==1:
            print('ㅇ.')
        elif dice==2:
            print('ㄴ.')
        elif dice==3:
            print('ㄹ.')
        elif dice==4:
            print('ㅎ.')
        elif dice==5:
            print('ㄱ.')
        else:
            print('ㅂ.')
        print('감사합니다.')
    
        input('시스템을 중지하시겠습니까?')
    
        if answer=='Y'or'y':
            break
        elif answer=='N'or'n':
            continue
    
    

    이 코드 마지막 부분에서 꼭 'N'이나 'n'을 입력해야만 처음으로 돌아가게 하고 싶은데 continue말고 어떤걸 입력해야 하나요?