I've got a big problem! I tried making a fun Sudoku puzzle generator for my friend, but I made some sort of mistake! I don't understand what I did wrong, but for some reason, every puzzle starts from the exact same initial seed! My friend hasn't figured this out yet, but I'd like to fix it so that the program actually works by making truly random games for her to play. Oh, the program is a Python program by the way. Here's what I have so far, could you please help m fix it?

#Import Python's random library, which allows for random number generation
import random

def generate_sudoku():
    # Create an empty 9x9 grid
    grid = [[0] * 9 for _ in range(9)]
    
    # Fill in the grid to create a completed Sudoku grid
    solve_sudoku(grid)
    
    # Remove some numbers to turn a completed
    # Sudoku grid into a puzzle
    remove_numbers(grid)
    
    # Output the generated puzzle
    return grid

def solve_sudoku(grid):
    # Find the next empty cell
    row, col = find_empty_cell(grid)
    
    # If no empty cells are found, the puzzle is solved
    if row == -1 and col == -1:
        return True
    
    # Try each number from 1 to 9
    for num in range(1, 10):
        if is_valid_move(grid, row, col, num):
            # Assign the number to the empty cell
            grid[row][col] = num
            
            # Recursively solve the Sudoku
            if solve_sudoku(grid):
                return True
            
            # If the current assignment does not lead to a solution,
            # reset the cell and try the next number
            grid[row][col] = 0
    
    # If no number can be placed, backtrack
    return False

def find_empty_cell(grid):
    # Find the next empty cell in the grid
    for i in range(9):
        for j in range(9):
            if grid[i][j] == 0:
                return i, j
    return -1, -1

def is_valid_move(grid, row, col, num):
    # Check if assigning the number to the given cell violates Sudoku rules
    
    # Check the row
    for j in range(9):
        if grid[row][j] == num:
            return False
    
    # Check the column
    for i in range(9):
        if grid[i][col] == num:
            return False
    
    # Check the 3x3 box
    box_start_row = 3 * (row // 3)
    box_start_col = 3 * (col // 3)
    for i in range(3):
        for j in range(3):
            if grid[box_start_row + i][box_start_col + j] == num:
                return False
    
    return True

def remove_numbers(grid):
    # Remove some numbers from the solved puzzle to create the puzzle
    
    # Determine the difficulty level (adjust the range of removals as desired)
    num_removals = 64
    
    # Check to see if the number of removals has been set to a value greater
    # than 64. Valid Sudoku puzzles must have at least 17 values
    # so this code ensures no more than 64 numbers are removed from the
    # completed Sudoku game.
    if num_removals >= 65:
        num_removals = 64

    # Collect the indices of non-zero cells
    non_zero_indices = [(i, j) for i in range(9) for j in range(9) if grid[i][j] != 0]
    
    # Randomly select cells from non_zero_indices and remove their values
    removal_indices = random.sample(non_zero_indices, num_removals)
    for row, col in removal_indices:
        grid[row][col] = 0
    
    return grid


def display_sudoku(grid):
    # Display the Sudoku grid
    for i in range(9):
        if i % 3 == 0 and i != 0:
            # Create a decorative horizontal dashed line to segment rows
            print("- - - - - - - - - - -")
        for j in range(9):
            if j % 3 == 0 and j != 0:
                # Create a decorative vertical dashed line to segment columns
                print("|", end=" ")
            if grid[i][j] == 0:
                # Fill each blank cell with a dot
                print(".", end=" ")
            else:
                # Place the numbers in the displayed puzzle
                print(grid[i][j], end=" ")
        print()

# Check to see if the program has been loaded as a script, and execute it
if __name__ == "__main__":
    # Generate and display a new Sudoku puzzle
    grid = generate_sudoku()
    display_sudoku(grid)
system
mujhe ek badi samasya mili he!maine apane dost ke liye ek mjedaar sudoku paheli janarator banane kii koshish kii, lekin maine kisi tarah kii galati kii!mujhe samaj nahin aa rahaa he ki maine kya galat kiya, lekin kisi kaaran se, har paheli thik usee praarambhik beej se shuru hoti he!mere dost ne abhi tak iskaa pataa nahin lagaaya he, lekin main ise thik karnaa chahta hum taaki kaarykram vastav main uske khilne ke liye vastav main yadrichhik game banaakar kaam kare.oh, kaarykram ek paythan kaarykram he.yahan mere paas ab tak kya he, kya aap kripaya ise thik karne main madad kar sakate hai?

#Import paythan kii yadrichhik pustkaalay, jo yadrichhik sankhya peedi ke liye anumati detaa he
yadrichhik aayaat

def generate_sudoku ():
    # ek khaali 9x9 grid banaaen
    grid = [[0] * 9 ke liye _ range (9) main]
    
    # ek purna sudoku grid banane ke liye grid main bharen
    solyu_sudoku (grid)
    
    # ek purna hone ke liye kuch number nikaalen
    # ek paheli main sudoku grid
    remove_numbers (grid)
    
    # utpann paheli ko output karen
    vaapasi grid

def solve_sudoku (grid):
    # agali khaali cell kaa pataa lagaaein
    pankti, col = find_empty_cell (grid)
    
    # yadi koi khaali koshikaayen nahin pai jaati hai, to paheli hal ho jaati he
    yadi pankti == -1 or col == -1:
        sahi vaapasi
    
    # prayek number ko 1 se 9 tak aazmaaen
    range main sankhya ke liye (1, 10):
        yadi is_valid_move (grid, pankti, karnal, sankhya):
            # khaali cell ko number asin karen
            grid [pankti] [karnal] = sankhya
            
            # punaravarti rup se sudoku ko hal karen
            yadi solve_sudoku (grid):
                sahi vaapasi
            
            # yadi vartmaan asinament ek samaadhaan ke liye netritv nahin karata he,
            # cell riset karen or agle number kaa prayaas karen
            grid [pankti] [karnal] = 0
    
    # yadi koi sankhya nahin rakhi ja sakati he, to bekatrack
    vivaran jhootha he

def find_empty_cell (grid):
    # grid main agali khaali cell kaa pataa lagaaein
    ke liye main range main (9):
        range main j ke liye (9):
            yadi grid [i] [j] == 0:
                ritern ai, je
    ritern -1, -1

def is_valid_move (grid, pankti, karnal, sankhya):
    # jaanch karen ki die gaye cell ko number asin karnaa sudoku niyamon kaa ulanghan karata he
    
    # pankti kii jaanch karen
    range main j ke liye (9):
        yadi grid [pankti] [j] == sankhya:
            vivaran jhootha he
    
    # kollam kii jaanch karen
    ke liye main range main (9):
        yadi grid [i] [Col] == NUM:
            vivaran jhootha he
    
    # 3x3 box kii jaanch karen
    box_start_row = 3 * (pankti // 3)
    box_start_col = 3 * (col // 3)
    main range main (3) ke liye:
        range main j ke liye (3):
            yadi grid [box_start_row + i] [box_start_col + j] == num:
                vivaran jhootha he
    
    sahi vaapasi

Def remove_numbers (grid):
    # paheli banane ke liye hal kii gai paheli se kuch numberon ko hataa den
    
    # kathinaayee str nirdhaarit karen (vaanchit ke rup main hataane kii seemaa ko samyojit karen)
    num_removals = 64
    
    # yah dekhne ke liye jaanch karen ki kya nishkasana kii sankhya adhik se adhik mulya par set kii gai he
    # 64 se adhik. vaid sudoku paheli main kam se kam 17 maan hone chahie
    # to yah code yah sunishchit karata he ki 64 se adhik sankhyaon ko se hataa diya jaae
    # puraa sudoku khel.
    yadi num_removals> = 65:
        num_removals = 64

    # gaiyr-shunya koshikaon ke suchakaankon ko ekatra karen
    non_zero_indices = [(i, j) i main range (9) ke liye j ke liye range (9) yadi grid [i] [j]! = 0]
    
    # betaratib dhang se non_zero_indices se koshikaon kaa chayan karen or unke maanon ko hataa den
    REMOVAL_INDICES = random.sample (NON_ZERO_INDICES, NUM_REMOVALS)
    ROW ke liye, COL in Remoll_indices:
        grid [pankti] [karnal] = 0
    
    vaapasi grid


DEF DISPLAY_SUDOKU (GRID):
    # sudoku grid pradarshit karen
    ke liye main range main (9):
        agar main % 3 == 0 or main! = 0:
            # khand panktiyon ke liye ek sajaavati kshaitij dharashayi line banaaen
            print (" - - - - - - - - - - -")
        range main j ke liye (9):
            yadi j % 3 == 0 or j! = 0:
                # segment kollam ke liye ek sajaavati urdhwadhar dharashayi line banaaen
                print ("|", ant = "")
            yadi grid [i] [j] == 0:
                # prayek rikt cell ko ek dot ke saath bharen
                print (".", ant = "")
            anya:
                # pradarshit paheli main sankhyaon ko rakhen
                print (grid [i] [j], ant = "")
        print ()

# yah dekhne ke liye jaanchen ki kya program ko script ke rup main lod kiya gaya he, or ise nishpadit karen
yadi __name__ == "__main__":
    # ek nai sudoku paheli utpann karen or pradarshit karen
    grid = generate_sudoku ()
    disple_sudoku (grid)
user
vartmaan karyanvayan ke saath samasya yah he ki yah sudoku paheli ke liye ek yadrichhik praarambhik grid utpann nahin karata he.isliye jab aapkaa code grid se yadrichhik mulyon ko hataa detaa he, to yah shuru main dikhaai de saktaa he ki kaarykram ek nai paheli utpann kar rahaa he, lekin kaarykram keval ek hi paheli kii vividhtaayen utpann kar rahaa he, bas alag -alag mulyon ke saath jo remove_numbers fnction dwaara yadrichhik rup se hataa diya gaya he.is samasya ko thik karne ke liye, ham ek nae sahaayak fnction ko lagu kar sakate hai jo grid ko punaravarti rup se bhar degaa.yahaan aapke dwaara prastut kiye gaye program kaa ek adhyatan sanskaran he, ek nae fnction ke saath jo Solve_sudoku or Find_empty_cell fnction kii jagah letaa he, jinaki ab aavashyaktaa nahin he.

`` `paythan
#Import paythan kii yadrichhik pustkaalay, jo yadrichhik sankhya peedi ke liye anumati detaa he
yadrichhik aayaat

def generate_sudoku ():
    # ek khaali 9x9 grid banaaen
    grid = [[0] * 9 ke liye _ range (9) main]
    
    # ek purna sudoku grid banane ke liye grid main bharen
    fill_numbers (grid)
    
    # ek purna hone ke liye kuch number nikaalen
    # ek paheli main sudoku grid
    remove_numbers (grid)

    # utpann paheli ko output karen
    vaapasi grid

def fill_numbers (grid):
    # 1 se 9 tak sankhyaon kii ek pherbadal suchi utpann karen
    num_list = suchi (range (1, 10))
    random.shafal (num_list)
    
    # grid main number bharne ke liye punaravarti prakriya shuru karen
    vaapasi fill_numbers_recursive (grid, num_list, 0)

def fill_numbers_recursive (grid, num_list, index):
    # base cese: yadi index antim cell se adhik he, to grid puri tarah se bharaa hua he
    yadi suchakank> = 81:
        sahi vaapasi

    pankti = suchakank // 9 # vartmaan suchakank se pankti suchakank kii gananaa karen
    COL = INDEX % 9 # vartmaan suchakank se kollam index kii gananaa karen

    yadi grid [pankti] [col]! = 0:
        # yadi vartmaan cell pehle se bharaa he, to agle cell par jaaen
        vaapasi fill_numbers_recursive (grid, num_list, index + 1)

    random.shafal (num_list)
    NUM_LIST main NUM ke liye:
        yadi is_valid_move (grid, pankti, karnal, sankhya):
            # yadi vartmaan sankhya vartmaan cell ke liye maanya he, to ise bharen
            grid [pankti] [karnal] = sankhya
            yadi fill_numbers_recursive (grid, num_list, index + 1):
                # punaravarti agle cell ko bharen
                sahi vaapasi
            grid [pankti] [col] = 0 # bekatrack yadi agali cell bhar nahin ja saktaa he

    vivaran jhootha he

def is_valid_move (grid, pankti, karnal, sankhya):
    # jaanch karen ki die gaye cell ko number asin karnaa sudoku niyamon kaa ulanghan karata he
    
    # pankti kii jaanch karen
    range main j ke liye (9):
        yadi grid [pankti] [j] == sankhya:
            vivaran jhootha he
    
    # kollam kii jaanch karen
    ke liye main range main (9):
        yadi grid [i] [Col] == NUM:
            vivaran jhootha he
    
    # 3x3 box kii jaanch karen
    box_start_row = 3 * (pankti // 3)
    box_start_col = 3 * (col // 3)
    main range main (3) ke liye:
        range main j ke liye (3):
            yadi grid [box_start_row + i] [box_start_col + j] == num:
                vivaran jhootha he
    
    sahi vaapasi

Def remove_numbers (grid):
    # paheli banane ke liye hal kii gai paheli se kuch numberon ko hataa den
    
    # kathinaayee str nirdhaarit karen (vaanchit ke rup main hataane kii seemaa ko samyojit karen)
    num_removals = 64
    
    # yah dekhne ke liye jaanch karen ki kya nishkasana kii sankhya adhik se adhik mulya par set kii gai he
    # 64 se adhik. vaid sudoku paheli main kam se kam 17 maan hone chahie
    # to yah code yah sunishchit karata he ki 64 se adhik sankhyaon ko se hataa diya jaae
    # puraa sudoku khel.
    yadi num_removals> = 65:
        num_removals = 64

    # gaiyr-shunya koshikaon ke suchakaankon ko ekatra karen
    non_zero_indices = [(i, j) i main range (9) ke liye j ke liye range (9) yadi grid [i] [j]! = 0]
    
    # betaratib dhang se non_zero_indices se koshikaon kaa chayan karen or unke maanon ko hataa den
    REMOVAL_INDICES = random.sample (NON_ZERO_INDICES, NUM_REMOVALS)
    ROW ke liye, COL in Remoll_indices:
        grid [pankti] [karnal] = 0
    
    vaapasi grid


DEF DISPLAY_SUDOKU (GRID):
    # sudoku grid pradarshit karen
    ke liye main range main (9):
        agar main % 3 == 0 or main! = 0:
            # khand panktiyon ke liye ek sajaavati kshaitij dharashayi line banaaen
            print (" - - - - - - - - - - -")
        range main j ke liye (9):
            yadi j % 3 == 0 or j! = 0:
                # segment kollam ke liye ek sajaavati urdhwadhar dharashayi line banaaen
                print ("|", ant = "")
            yadi grid [i] [j] == 0:
                # prayek rikt cell ko ek dot ke saath bharen
                print (".", ant = "")
            anya:
                # pradarshit paheli main sankhyaon ko rakhen
                print (grid [i] [j], ant = "")
        print ()

# yah dekhne ke liye jaanchen ki kya program ko script ke rup main lod kiya gaya he, or ise nishpadit karen
yadi __name__ == "__main__":
    # ek nai sudoku paheli utpann karen or pradarshit karen
    grid = generate_sudoku ()
    disple_sudoku (grid)
`` `
assistant
<|system|>
</s>
<|user|>
mujhe ek badi samasya mili he!maine apane dost ke liye ek mjedaar sudoku paheli janarator banane kii koshish kii, lekin maine kisi tarah kii galati kii!mujhe samaj nahin aa rahaa he ki maine kya galat kiya, lekin kisi kaaran se, har paheli thik usee praarambhik beej se shuru hoti he!mere dost ne abhi tak iskaa pataa nahin lagaaya he, lekin main ise thik karnaa chahta hum taaki kaarykram vastav main uske khilne ke liye vastav main yadrichhik game banaakar kaam kare.oh, kaarykram ek paythan kaarykram he.yahan mere paas ab tak kya he, kya aap kripaya ise thik karne main madad kar sakate hai?

#Import paythan kii yadrichhik pustkaalay, jo yadrichhik sankhya peedi ke liye anumati detaa he
yadrichhik aayaat

def generate_sudoku ():
    # ek khaali 9x9 grid banaaen
    grid = [[0] * 9 ke liye _ range (9) main]
    
    # ek purna sudoku grid banane ke liye grid main bharen
    solyu_sudoku (grid)
    
    # ek purna hone ke liye kuch number nikaalen
    # ek paheli main sudoku grid
    remove_numbers (grid)
    
    # utpann paheli ko output karen
    vaapasi grid

def solve_sudoku (grid):
    # agali khaali cell kaa pataa lagaaein
    pankti, col = find_empty_cell (grid)
    
    # yadi koi khaali koshikaayen nahin pai jaati hai, to paheli hal ho jaati he
    yadi pankti == -1 or col == -1:
        sahi vaapasi
    
    # prayek number ko 1 se 9 tak aazmaaen
    range main sankhya ke liye (1, 10):
        yadi is_valid_move (grid, pankti, karnal, sankhya):
            # khaali cell ko number asin karen
            grid [pankti] [karnal] = sankhya
            
            # punaravarti rup se sudoku ko hal karen
            yadi solve_sudoku (grid):
                sahi vaapasi
            
            # yadi vartmaan asinament ek samaadhaan ke liye netritv nahin karata he,
            # cell riset karen or agle number kaa prayaas karen
            grid [pankti] [karnal] = 0
    
    # yadi koi sankhya nahin rakhi ja sakati he, to bekatrack
    vivaran jhootha he

def find_empty_cell (grid):
    # grid main agali khaali cell kaa pataa lagaaein
    ke liye main range main (9):
        range main j ke liye (9):
            yadi grid [i] [j] == 0:
                ritern ai, je
    ritern -1, -1

def is_valid_move (grid, pankti, karnal, sankhya):
    # jaanch karen ki die gaye cell ko number asin karnaa sudoku niyamon kaa ulanghan karata he
    
    # pankti kii jaanch karen
    range main j ke liye (9):
        yadi grid [pankti] [j] == sankhya:
            vivaran jhootha he
    
    # kollam kii jaanch karen
    ke liye main range main (9):
        yadi grid [i] [Col] == NUM:
            vivaran jhootha he
    
    # 3x3 box kii jaanch karen
    box_start_row = 3 * (pankti // 3)
    box_start_col = 3 * (col // 3)
    main range main (3) ke liye:
        range main j ke liye (3):
            yadi grid [box_start_row + i] [box_start_col + j] == num:
                vivaran jhootha he
    
    sahi vaapasi

Def remove_numbers (grid):
    # paheli banane ke liye hal kii gai paheli se kuch numberon ko hataa den
    
    # kathinaayee str nirdhaarit karen (vaanchit ke rup main hataane kii seemaa ko samyojit karen)
    num_removals = 64
    
    # yah dekhne ke liye jaanch karen ki kya nishkasana kii sankhya adhik se adhik mulya par set kii gai he
    # 64 se adhik. vaid sudoku paheli main kam se kam 17 maan hone chahie
    # to yah code yah sunishchit karata he ki 64 se adhik sankhyaon ko se hataa diya jaae
    # puraa sudoku khel.
    yadi num_removals> = 65:
        num_removals = 64

    # gaiyr-shunya koshikaon ke suchakaankon ko ekatra karen
    non_zero_indices = [(i, j) i main range (9) ke liye j ke liye range (9) yadi grid [i] [j]! = 0]
    
    # betaratib dhang se non_zero_indices se koshikaon kaa chayan karen or unke maanon ko hataa den
    REMOVAL_INDICES = random.sample (NON_ZERO_INDICES, NUM_REMOVALS)
    ROW ke liye, COL in Remoll_indices:
        grid [pankti] [karnal] = 0
    
    vaapasi grid


DEF DISPLAY_SUDOKU (GRID):
    # sudoku grid pradarshit karen
    ke liye main range main (9):
        agar main % 3 == 0 or main! = 0:
            # khand panktiyon ke liye ek sajaavati kshaitij dharashayi line banaaen
            print (" - - - - - - - - - - -")
        range main j ke liye (9):
            yadi j % 3 == 0 or j! = 0:
                # segment kollam ke liye ek sajaavati urdhwadhar dharashayi line banaaen
                print ("|", ant = "")
            yadi grid [i] [j] == 0:
                # prayek rikt cell ko ek dot ke saath bharen
                print (".", ant = "")
            anya:
                # pradarshit paheli main sankhyaon ko rakhen
                print (grid [i] [j], ant = "")
        print ()

# yah dekhne ke liye jaanchen ki kya program ko script ke rup main lod kiya gaya he, or ise nishpadit karen
yadi __name__ == "__main__":
    # ek nai sudoku paheli utpann karen or pradarshit karen
    grid = generate_sudoku ()
    disple_sudoku (grid)</s>
<|assistant|>
vartmaan karyanvayan ke saath samasya yah he ki yah sudoku paheli ke liye ek yadrichhik praarambhik grid utpann nahin karata he.isliye jab aapkaa code grid se yadrichhik mulyon ko hataa detaa he, to yah shuru main dikhaai de saktaa he ki kaarykram ek nai paheli utpann kar rahaa he, lekin kaarykram keval ek hi paheli kii vividhtaayen utpann kar rahaa he, bas alag -alag mulyon ke saath jo remove_numbers fnction dwaara yadrichhik rup se hataa diya gaya he.is samasya ko thik karne ke liye, ham ek nae sahaayak fnction ko lagu kar sakate hai jo grid ko punaravarti rup se bhar degaa.yahaan aapke dwaara prastut kiye gaye program kaa ek adhyatan sanskaran he, ek nae fnction ke saath jo Solve_sudoku or Find_empty_cell fnction kii jagah letaa he, jinaki ab aavashyaktaa nahin he.

`` `paythan
#Import paythan kii yadrichhik pustkaalay, jo yadrichhik sankhya peedi ke liye anumati detaa he
yadrichhik aayaat

def generate_sudoku ():
    # ek khaali 9x9 grid banaaen
    grid = [[0] * 9 ke liye _ range (9) main]
    
    # ek purna sudoku grid banane ke liye grid main bharen
    fill_numbers (grid)
    
    # ek purna hone ke liye kuch number nikaalen
    # ek paheli main sudoku grid
    remove_numbers (grid)

    # utpann paheli ko output karen
    vaapasi grid

def fill_numbers (grid):
    # 1 se 9 tak sankhyaon kii ek pherbadal suchi utpann karen
    num_list = suchi (range (1, 10))
    random.shafal (num_list)
    
    # grid main number bharne ke liye punaravarti prakriya shuru karen
    vaapasi fill_numbers_recursive (grid, num_list, 0)

def fill_numbers_recursive (grid, num_list, index):
    # base cese: yadi index antim cell se adhik he, to grid puri tarah se bharaa hua he
    yadi suchakank> = 81:
        sahi vaapasi

    pankti = suchakank // 9 # vartmaan suchakank se pankti suchakank kii gananaa karen
    COL = INDEX % 9 # vartmaan suchakank se kollam index kii gananaa karen

    yadi grid [pankti] [col]! = 0:
        # yadi vartmaan cell pehle se bharaa he, to agle cell par jaaen
        vaapasi fill_numbers_recursive (grid, num_list, index + 1)

    random.shafal (num_list)
    NUM_LIST main NUM ke liye:
        yadi is_valid_move (grid, pankti, karnal, sankhya):
            # yadi vartmaan sankhya vartmaan cell ke liye maanya he, to ise bharen
            grid [pankti] [karnal] = sankhya
            yadi fill_numbers_recursive (grid, num_list, index + 1):
                # punaravarti agle cell ko bharen
                sahi vaapasi
            grid [pankti] [col] = 0 # bekatrack yadi agali cell bhar nahin ja saktaa he

    vivaran jhootha he

def is_valid_move (grid, pankti, karnal, sankhya):
    # jaanch karen ki die gaye cell ko number asin karnaa sudoku niyamon kaa ulanghan karata he
    
    # pankti kii jaanch karen
    range main j ke liye (9):
        yadi grid [pankti] [j] == sankhya:
            vivaran jhootha he
    
    # kollam kii jaanch karen
    ke liye main range main (9):
        yadi grid [i] [Col] == NUM:
            vivaran jhootha he
    
    # 3x3 box kii jaanch karen
    box_start_row = 3 * (pankti // 3)
    box_start_col = 3 * (col // 3)
    main range main (3) ke liye:
        range main j ke liye (3):
            yadi grid [box_start_row + i] [box_start_col + j] == num:
                vivaran jhootha he
    
    sahi vaapasi

Def remove_numbers (grid):
    # paheli banane ke liye hal kii gai paheli se kuch numberon ko hataa den
    
    # kathinaayee str nirdhaarit karen (vaanchit ke rup main hataane kii seemaa ko samyojit karen)
    num_removals = 64
    
    # yah dekhne ke liye jaanch karen ki kya nishkasana kii sankhya adhik se adhik mulya par set kii gai he
    # 64 se adhik. vaid sudoku paheli main kam se kam 17 maan hone chahie
    # to yah code yah sunishchit karata he ki 64 se adhik sankhyaon ko se hataa diya jaae
    # puraa sudoku khel.
    yadi num_removals> = 65:
        num_removals = 64

    # gaiyr-shunya koshikaon ke suchakaankon ko ekatra karen
    non_zero_indices = [(i, j) i main range (9) ke liye j ke liye range (9) yadi grid [i] [j]! = 0]
    
    # betaratib dhang se non_zero_indices se koshikaon kaa chayan karen or unke maanon ko hataa den
    REMOVAL_INDICES = random.sample (NON_ZERO_INDICES, NUM_REMOVALS)
    ROW ke liye, COL in Remoll_indices:
        grid [pankti] [karnal] = 0
    
    vaapasi grid


DEF DISPLAY_SUDOKU (GRID):
    # sudoku grid pradarshit karen
    ke liye main range main (9):
        agar main % 3 == 0 or main! = 0:
            # khand panktiyon ke liye ek sajaavati kshaitij dharashayi line banaaen
            print (" - - - - - - - - - - -")
        range main j ke liye (9):
            yadi j % 3 == 0 or j! = 0:
                # segment kollam ke liye ek sajaavati urdhwadhar dharashayi line banaaen
                print ("|", ant = "")
            yadi grid [i] [j] == 0:
                # prayek rikt cell ko ek dot ke saath bharen
                print (".", ant = "")
            anya:
                # pradarshit paheli main sankhyaon ko rakhen
                print (grid [i] [j], ant = "")
        print ()

# yah dekhne ke liye jaanchen ki kya program ko script ke rup main lod kiya gaya he, or ise nishpadit karen
yadi __name__ == "__main__":
    # ek nai sudoku paheli utpann karen or pradarshit karen
    grid = generate_sudoku ()
    disple_sudoku (grid)
`` `</s>
