내가 만든 자판기

2025. 2. 21. 17:18·Python/연습장
#자판기
#사용자에게
user_money2 = input("돈을 넣어주세요.: ")
user_money2 = int(user_money2)
user_select2 = input("음료를 골라주세요.: ")

if user_money2 >= 900 and user_select2 == "코카콜라":
    print("코카콜라")
    user_money2 = user_money2 - 900
elif user_money2 < 900 and user_select2 == "코카콜라":
    print("돈이 부족합니다.")
elif user_money2 >= 800 and user_select2 == "펩시콜라":
    print("펩시콜라")
    user_money2 = user_money2 - 800
elif user_money2 < 800 and user_select2 == "펩시콜라":
    print("돈이 부족합니다.")
elif user_money2 >= 700 and user_select2 == "포카리":
    print("포카리")
    user_money2 = user_money2 - 700
elif user_money2 < 700 and user_select2 == "포카리":
    print("돈이 부족합니다.")
elif user_money2 >= 500 and user_select2 == "물":
    print("물")
    user_money2 = user_money2 - 500
elif user_money2 < 500 and user_select2 == "물":
    print("돈이 부족합니다.")

else: #돈x메뉴x=메뉴x
    user_select2 != "코카콜라", "펩시콜라", "포카리", "물"
    # user_money2 < 900 and user_select2 != "코카콜라"
    # user_money2 < 800 and user_select2 != "펩시콜라"
    # user_money2 < 700 and user_select2 != "포카리"
    # user_money2 < 500 and user_select2 != "물"
    print("해당 메뉴가 존재하지 않습니다.")

print(user_money2)

'Python > 연습장' 카테고리의 다른 글

로또 자동 판매기 (no sample)  (0) 2025.02.26
안끝나는 자판기  (0) 2025.02.24
교수님이 만든 자판기  (0) 2025.02.21
가위바위보 게임  (0) 2025.02.21
내가 만든 자유과제  (0) 2025.02.21
'Python/연습장' 카테고리의 다른 글
  • 로또 자동 판매기 (no sample)
  • 안끝나는 자판기
  • 교수님이 만든 자판기
  • 가위바위보 게임
joo_coding
joo_coding
2025.02.18~
  • joo_coding
    주코딩일지
    joo_coding
  • 전체
    오늘
    어제
    • 분류 전체보기 (219)
      • 일지 (19)
      • 계획표 (7)
      • 프로젝트 (6)
      • C언어 (35)
        • 연습장 (12)
      • C++ (3)
      • C# (34)
      • Python (28)
        • 연습장 (11)
      • TCP IP (4)
      • DB (2)
      • ubuntu (1)
      • Git (0)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    c언어 #vscode #gcc #윈도우 #c언어윈도우 #gcc윈도우 #vscode윈도우 #c #c++
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
joo_coding
내가 만든 자판기
상단으로

티스토리툴바