Поиск по сайту
Результаты поиска по тегам 'помощь'.
Найдено 1 результат
-
Решил потренироваться в python и написать игру типа наперстков. И вроде написал и запускается, но когда доходишь до самой игры (28 строка) программа крашится. Циклы удалял, брейки тоже, с бубном танцевал, компьютер материл, через дебагер пробовал вообще все ломается. Может кто подскажет в чем проблема? Вот сам код: import random import sys #Greetings print("Welcome to the thimbles!") print("Enter a command: ") print("H - help") #Game start while True: #Main menu cycle UInput = input() if UInput == "q" or UInput == "Q": break #Exit function if UInput == "H" or UInput == "h" or UInput == "Help" or UInput == "help": #Help function print("To start the game, enter G. To call this list, enter H. To exit, enter Q") print("Enter a command: ") elif UInput == "g" or UInput == "G" or UInput == "game" or UInput == "Game": #Game start print("Well well, look who is come to me! Do you wana play with me? (y/n)") while True: #Game menu cycle UInput = input() #User input if UInput == "q" or UInput == "Q": break G = 10 #Start Gold count if UInput == "y": print("Well then sitdown here and give me some of your's gold. If you win, you will get doubled of them. ") while True: #Game cycle GInGame = input("How much gold you will give to the stranger? (You have " + G + " gold)") if GInGame > G: print("You don't have this amount of gold") GInGame = int(input("How much gold you will give to the stranger? (You have " + G + " gold)")) G = G - GInGame #Remove gold what now in game RightCup = random.uniform(1, 3) #Random generator for game CCup = input("What cup you will chose? (1-3) ") if CCup == RightCup: #Player chose right cup GInGame = GInGame * 2 #Gold in game multiplise by 2 print("You luky! Here your's " + GInGame + "gold.") G = G + GInGame #Adding gold to the sorce GInGame = 0 #Reset in game gold else: #Player lose print("I won.") GInGame = 0 #Reset in game gold print("Play agan? (y/n)") #Play game again if UInput == "n": break else: print("Ok then.") else: print("If no, then get out of here!") break else: print("No such command.") print("Enter a command: ") My_game.py