python/반복문

쇼핑몰 뒤로가기2

june__Park 2021. 2. 25. 14:40
# 쇼핑몰 뒤로가기
# 1. 남성의류
# 		1) 티셔츠
# 		2) 바지
# 		3) 뒤로가기
# 2. 여성의류
# 		1) 가디건
# 		2) 치마
# 		3) 뒤로가기
# 3. 종료

run = True
while run:
    print("1.남성의류")
    print("2.여성의류")
    print("3.종료")

    select = int(input("메뉴 선택 : "))

    if select == 1:
        run1 = True
        while run1:
            print("1) 티셔츠")
            print("2) 바지")
            print("3) 뒤로가기")

            choice1 = int(input("메뉴 선택 : "))

            if choice1 == 1:
                print("티셔츠 구매하였습니다.")
            elif choice1 == 2:
                print("바지 구매하였습니다.")
            elif choice1 == 3:
                run1 = False
                
    elif select == 2:
        run2 = True
        while run2:
            print("1) 가디건")
            print("2) 치마")
            print("3) 뒤로가기")

            choice2 = int(input("메뉴 선택: "))
            if choice2 == 1:
                print("가디건 구매하였습니다.")
            elif choice2 == 2:
                print("치마 구매하였습니다.")
            elif choice2 == 3:
                run2 = False

    elif select == 3:
        run = False
        print("프로그램 종료")