def Turn_on_game(): # 1. 실행 메시지를 표시 (Turn on game) print('= Turn on game =') # 2. 사용자에게 무엇을 할 것 인지 물어보기 # 1. play game # 2. buy_item # 3. exit while True: try: selected = input('무엇을 실행 하시겠습니까?(1:play_game, 2:buy_item) : ') if int(selected) == 1: #buy_gmae() play_game() elif int(selected) == 2: buy_item() elif int(selected) == 0: break elif int(selected) == 3: send_message() else: print('invalid input') except ValueError: print('must input number') print('Game Over')
def turn_on(): print('= Turn on game=') while True: choice=input('뭐할래\n 1: 상점가기\n 2:게임시작하기\n 3:메세지\n4:종료\n 입력.') if choice == '1': shop.buy_item() elif choice == '2': game.play_game() elif choice == '3': friends.send_message() elif choice == '4': break else: print('1, 2, 3, 4중 하나를 입력하세요')
def turn_on(): print('=Turn on game =') while True: choice = input('뭐할래?\n 1: 상점가기\n 2: 게임시작하기\n 3: 메시지보내기\n 0: 종료\n 입력:') if choice == '1': shop.buy_item() elif choice == '2': play_game() elif choice == '3': chat.send_message() elif choice == '0': break else: print('1, 2, 3, 0중 하나를 입력해주세요')
def turn_on(): print('= Start game =') while True: choice = input('What would you like to do?\n 1: Go Shop\n 2: Play Game\n 3: Send Message\n 0: Exit\n Input : ') if choice == '0': break elif choice == '1': buy_item() elif choice == '2': play_game() elif choice == '3': chat.send_message() else: print('Choice not exist') print('-----------------------') print('= End game =')
def turn_on(): print('= Turn on game =') while True: choice = input('뭐할래?\n 1: 상점가기\n 2: 게임시작하기\n 3 or 4: 메시지 보내기\n 0: 종료\n 입력: ') if choice == '1': shop.buy_item() elif choice == '2': play_game() elif choice == '3': send_message() elif choice == '4': friend = input('친구명: ') message = input('메시지: ') send_message2(friend, message) elif choice == '0': break else: print('1, 2, 3중 하나를 입력해주세요')
def turn_on(): print('= Turn on game =') while True: choice = input( 'What would you like to do?\n 1: Go to Shop, 2: Play Game, 0: Exit\n Input : ' ) if choice == '0': break elif choice == '1': shop_show_info() buy_item() elif choice == '2': functions.game.show_info() functions.play_game() else: print('Choice not exist') print('-----------------------') print('= Turn off game =')
def turn_on(): print('= Turn on game =') while True: choice = input('What would you like to do?\n' ' 1: Go to Shop\n' ' 2: Play Game\n' ' 3: Send Message\n' ' 0: Exit\n' 'Input: ') if choice == '1': shop_show_info() buy_item() elif choice == '2': functions.game.show_info() functions.game.play_game() elif choice == '3': friends.send_message() elif choice == '0': break else: print('Choice not exist') print('--------------------------') print('= Turn off game =')
import sys from functions.shop import buy_item, title as shop_title from functions.game import play_game, title as game_title title = 'main module' if __name__ == '__main__': game.play_game() buy_item() print(title) print(shop_title) print(game_title) play_game() buy_item()
from functions.game import play_game from functions.shop import play_game as play_game_shop from functions import shop from friends.chat import send_message import functions if __name__ == '__main__': print(dir(functions)) # input()을 이용해서 값을 받는다 # -> 적절히 1번은 게임실행, 2번은 아이템사기 라고 출력해주기 # 받은 값이 1인 경우, game.play_game()을 실행 # 받은 값이 2인 경우, shop.buy_item()을 실행 # 받은 값이 0인 경우, 프로그램을 종료 # 0이 아닌 값을 받은 경우 다시 input()을 이용해서 실행할 명령을 받도록 한다 (무한반복, while문을 사용) print('= Turn on game =') while True: val = input('1: 게임실행, 2: 아이템사기, 3: 메세지 보내기, 0: 종료\n입력: ') if val == '1': play_game() play_game_shop() shop.play_game() elif val == '2': shop.buy_item() elif val == '3': send_message() elif val == '0': break print()
if __name__ == '__main__': # 1. 실행 메시지를 표시 (Turn on game) # 2. 사용자에게 무엇을 할 것인지 물어보기 # 1. play game # 2. buy_item # 0. exit # 3. 1또는 2를 입력 시 해당 함수 실행 후 다시 사용자에게 무엇을 할 지 물어보기 # 4. 0을 입력하면 물어보는 반복문을 탈출하고 게임종료 메시지 표시 (Game over) print('= Turn on game =') while True: print(CHOICE) choice = input('무엇을 하실래요: ') if choice == '1': play_game() print(f'msg: {PLAY_MESSAGE}') elif choice == '2': buy_item() elif choice == '3': send_message() elif choice == '0': break else: print('가능한 명령의 번호를 입력해주세요') print('') print('= Game over =') #print(f'lol.py의 module name: {__name__}')