Python перестает печатать, и я не могу понять, как это исправитьPython

Программы на Python
Ответить
Anonymous
 Python перестает печатать, и я не могу понять, как это исправить

Сообщение Anonymous »

Я делаю русскую игру-рулет, и иногда она печатает только одну строку, а затем заставляет других игроков ходить. Я постарался максимально его настроить.

Снимок экрана: он работает, затем прекращает печатать то, что должен печатать.
Вот код:
import random as rand
import keyboard
import time
Playerhealth = 3
CPUhealth = 3
Chamber = [1, 2, 3, 4, 5, 6]
Loadedslot = rand.choice(Chamber)
while keyboard.is_pressed('Q') == False:
fire = rand.choice(Chamber)
Choice = input("Choose to shoot either yourself or the CPU (Y/C):")
print("Press space to shoot")
keyboard.wait('space')
if Choice == ("Y" or "y") or "Y" in Choice:
if fire == Loadedslot:
print("The gun fired! -1 life")
Playerhealth = Playerhealth - 1
print(f"Lives left: {Playerhealth}")
Chamber = [1, 2, 3, 4, 5, 6]
Loadedslot = rand.choice(Chamber)
if fire != Loadedslot:
print("The gun didn't fire!")
print(f"Lives left: {Playerhealth}")
Chamber.remove(fire)
if Choice == ("C" or "c") or "C" in Choice:
if fire == Loadedslot:
print("The gun fired")
CPUhealth = CPUhealth - 1
print(f"CPU lives left: {CPUhealth}")
Chamber = [1, 2, 3, 4, 5, 6]
Loadedslot = rand.choice(Chamber)
if fire != Loadedslot:
print("The gun didn't fire!")
print(f"CPU lives left: {CPUhealth}")
Chamber.remove(fire)
time.sleep(1)
CPUfire = rand.choice(Chamber)
CPUChoices = [1, 2]
CPUchoice = rand.choice(CPUChoices)
print("CPU's turn!")
if CPUchoice == 1:
if CPUfire == Loadedslot:
print("The CPU aimed at you!")
print("The gun fired!")
Playerhealth = Playerhealth - 1
print(f"Lives left: {Playerhealth}")
if CPUfire != Loadedslot:
print("The CPU aimed at you!")
print("The gun didn't fire!")
print(f"Lives left: {Playerhealth}")
if CPUchoice == 2:
if CPUfire == Loadedslot:
print("The CPU aimed at itself!")
print("The gun fired!")
CPUhealth = CPUhealth - 1
print(f"CPU lives left: {CPUhealth}")
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Python»