When I say no to the is there anyone that doesn't want to play it crashes I want it to ask for the user if there is anyone that does not want to play and delete them off the list then asks if there is anymore. After I want it to load the game.
import pygame
from pygame import *
import random
import time
import sys
pygame.init()
Red = (247, 12, 12)
White = (255,255,255)
Blue = (0, 157, 255)
Black=(0,0,0)
Person_One = random.randint(0,19)
Person_Two = random.randint(0,19)
Number1 = random.randint(0,100)
Number2 = random.randint(0,100)
Number1 = random.randint(0,100)
Number2 = random.randint(0,100)
mmm = ["Donald", "Jacey","Baxter","Dusan","Nathaniel","Hayden","Yusuf","Hayley","Andre","Rafif","Jeremey","Mark","Tia","Malu","Dorian","Jarius","Sammar","Peter","Rafif","Jasmin"]
Playerone = mmm[Person_One]
Playertwo = mmm[Person_Two]
X = 1400
timer = 0
Y = 1000
noonbe = input("Does anyone not want to play?\n")
noonbe.lower()
if noonbe == 'yes':
thenwho = input("Who is it?\n")
mmm.remove(thenwho)
noonbe = input("Does anyone else not want to play?\n")
noonbe.lower()
if noonbe == 'yes':
thenwho = input("Who is it?\n")
mmm.remove(thenwho)
noonbe = input("Does anyone else not want to play?\n")
noonbe.lower()
if noonbe == 'no':
pass
display_surface = pygame.display.set_mode((X, Y))
font = pygame.font.Font('freesansbold.ttf', 20)
text = font.render("Player one is:", True, Black, White)
textRect = text.get_rect()
textRect.center = (X // 4.4, Y // 3.6)
text1 = font.render(Playerone, True, Black, White)
text1Rect = text1.get_rect()
text1Rect.center = (X // 4.4, Y // 3)
text2 = font.render("Player two is:", True, Black, White)
text2Rect = text2.get_rect()
text2Rect.center = (X // 1.5, Y // 3.6)
text3 = font.render(Playertwo, True, Black, White)
text3Rect = text3.get_rect()
text3Rect.center = (X // 1.5, Y // 3)
aa = True
while True:
# completely fill the surface object
# with white color
display_surface.fill(White)
# copying the text surface object
# to the display surface object
# at the center coordinate.
display_surface.blit(text, textRect)
display_surface.blit(text1, text1Rect)
display_surface.blit(text2, text2Rect)
display_surface.blit(text3, text3Rect)
aa = False
Number2=str(Number2)
text3 = font.render(Number2, True, Black, White)
text3Rect = text3.get_rect()
text3Rect.center = (X // 1.5, Y // 3)
pygame.display.update()
time.sleep(20)
font = pygame.font.Font('freesansbold.ttf', 20)
text2 = font.render("Player two's number is:", True, Black, White)
text2Rect = text2.get_rect()
text2Rect.center = (X // 1.5, Y // 3.6)
Number1 = str(Number1)
text1 = font.render(Number1, True, Black, White)
text1Rect = text1.get_rect()
text1Rect.center = (X // 4.4, Y // 3)
font = pygame.font.Font('freesansbold.ttf', 20)
text = font.render("Player one's number is:", True, Black, White)
textRect = text.get_rect()
textRect.center = (X // 4.4, Y // 3.6)
display_surface.blit(text, textRect)
display_surface.blit(text1, text1Rect)
display_surface.blit(text2, text2Rect)
display_surface.blit(text3, text3Rect)
It even happened when i didnt add the sys.exit() I do not know why stuff like this is happening to me where i know where to put the stuff but somehow needs to go somewhere else