Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

What is exit code 1796?

+5 votes
asked Jun 17 by Colin Broyles (650 points)
edited Jun 17 by Colin Broyles
I sometimes get exit code 1796 with no other output, and sometimes it works properly. What is exit code 1796, and is there a way I can fix this?

Edit: I also sometimes get exit code NaN, but neither are very often

I am running this python code:

import random, time #Imports needed functions (Randomizer and time call)

starttime = time.time()

coins = 0

nearbyenemies = []

allenemies = [
#Follows pattern:
#[Level, Name, MinHealth, MaxHealth, MinAttack, MaxAttack, MinArmor, MaxArmor,
#Weakness, Resistance, Special, MinSpecialValue, MaxSpecialValue]
    [1, 'Spike', 10, 15, 3, 5, 0, 0, 'None', 'None', 'Thorns', 3, 5],
    [1, 'Skeleton', 10, 15, 5, 8, 5, 10, 'None', 'None', 'None', 0, 0],
    [1, 'Ghost', 1, 1, 10, 15, 10, 15, 'None', 'None', 'None', 0, 0]
]

def nearby(minlevel, maxlevel, amount, add): #Adds nearby enemies between certain levels
    
    global nearbyenemies
    possibleEnemies = []
    
    if add == True:
        nearbyenemies = nearbyenemies
    else:
        nearbyenemies = []
    
    x = 0
    
    while x < len(allenemies):
        if allenemies[x][0] >= minlevel & allenemies[x][0] <= maxlevel:
            possibleEnemies.append( allenemies[x] )
        x += 1
    
    x = 0
    
    while x < amount:
        nearbyenemies.append( possibleEnemies[random.randint(0, len(possibleEnemies) - 1)] )
        
        x += 1

nearby(1, 1, 2, False)
print(f'Enemies: {nearbyenemies}')

1 Answer

0 votes
answered 6 days ago by Peter Minarik (54,540 points)

When I run the above code, it finishes with exit code 0:

Enemies: [[1, 'Ghost', 1, 1, 10, 15, 10, 15, 'None', 'None', 'None', 0, 0], [1, 'Spike', 10, 15, 3, 5, 0, 0, 'None', 'None', 'Thorns', 3, 5]]

...Program finished with exit code 0
Press ENTER to exit console.

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...