Problem with random card generator (edit: resolved)

I’m using python to make a random card generator for a dnd thing called a deck of many things. Each time you use the deck you choose how many cards you are going to draw, so I want that to be reflected in my program. Originally I had an issue with the program generating the same card multiple times in a single round of drawing, so I added some code to correct that but as a consequence my probability became unbalanced so I added some code to fix that but now I’m having an issue with the deck generating fewer cards than the code specifies to draw as a result of a continue function I added. I’ll post the code below. It runs without any error messages.

import random

This is a multivariable list with the name of each card and the card description. Ther

cards_and_descriptions = [[‘Vizier’, ‘At any time you choose within one year of drawing this card, you can ask a question in meditation and mentally receive a truthful answer to that question. Besides information, the answer helps you solve a puzzling problem or other dilemma. In other words, the knowledge comes with Wisdom on how to apply it.’], [‘Sun’, ‘You gain 50,000 XP, and a wondrous item (which the DM determines randomly) appears in your hands.’], [‘Moon’, ‘You are granted the ability to cast the wish spell 1d3 times.’], [‘Star’, “Increase one of your Ability Scores by 2. The score can exceed 20 but can’t exceed 24.”], [‘Comet’, ‘If you single-handedly defeat the next Hostile monster or group of Monsters you encounter, you gain Experience Points enough to gain one level. Otherwise, this card has no Effect.’], [‘The Fates’, “Reality’s fabric unravels and spins anew, allowing you to avoid or erase one event as if it never happened. You can use the card’s magic as soon as you draw the card or at any other time before you die.”], [‘Throne’, ‘You gain proficiency in the Persuasion skill, and you double your Proficiency Bonus on checks made with that skill. In addition, you gain rightful ownership of a small keep somewhere in the world. However, the keep is currently in the hands of Monsters, which you must clear out before you can claim the keep as. yours.’], [‘Key’, ‘A rare or rarer Magic Weapon with which you are proficient appears in your hands. The DM chooses the weapon.’], [‘Knight’, ‘You gain the service of a 4th-level Fighter who appears in a space you choose within 30 feet of you. The Fighter is of the same race as you and serves you loyally until death, believing the fates have drawn him or her to you. You control this character.’], [‘Gem’, ‘Twenty-five pieces of jewelry worth 2,000 gp each or fifty gems worth 1,000 gp each appear at your feet.’], [‘Talons’, “Every magic item you wear or carry disintegrates. Artifacts in your possession aren’t destroyed but do Vanish.”], [‘The Void’, “This black card Spells Disaster. Your soul is drawn from your body and contained in an object in a place of the DM’s choice. One or more powerful beings guard the place. While your soul is trapped in this way, your body is Incapacitated. A wish spell can’t restore your soul, but the spell reveals the Location of the object that holds it. You draw no more cards.”], [‘Flames’, ‘A powerful devil becomes your enemy. The devil seeks your ruin and plagues your life, savoring your suffering before attempting to slay you. This enmity lasts until either you or the devil dies.’], [‘Skull’, “You summon an avatar of death-a ghostly Humanoid Skeleton clad in a tattered black robe and carrying a spectral scythe. It appears in a space of the DM’s choice within 10 feet of you and attacks you, warning all others that you must win the battle alone. The avatar fights until you die or it drops to 0 Hit Points, whereupon it disappears. If anyone tries to help you, the helper summons its own Avatar of Death. A creature slain by an Avatar of Death can’t be restored to life.”], [‘Idiot’, ‘Permanently reduce your Intelligence by 1d4 + 1 (to a minimum score of 1). You can draw one additional card beyond your declared draws.’], [‘Donjon’, “You disappear and become entombed in a state of suspended animation in an extradimensional Sphere. Everything you were wearing and carrying stays behind in the space you occupied when you disappeared. You remain imprisoned until you are found and removed from the Sphere. You can’t be located by any Divination magic, but a wish spell can reveal the Location of your prison. You draw no more cards.”], [‘Ruin’, ‘All forms of Wealth that you carry or own, other than Magic Items, are lost to you. Portable property vanishes. Businesses, buildings, and land you own are lost in a way that alters reality the least. Any documentation that proves you should own something lost to this card also disappears.’], [‘Euryale’, “The card’s medusa-like visage Curses you. You take a -2 penalty on Saving Throws while Cursed in this way. Only a god or the magic of The Fates card can end this curse.”], [‘Rogue’, “A nonplayer character of the DM’s choice becomes Hostile toward you. The identity of your new enemy isn’t known until the NPC or someone else reveals it. Nothing less than a wish spell or Divine Intervention can end the NPC’s hostility toward you.”], [‘Balance’, ‘Your mind suffers a wrenching alteration, causing your Alignment to change. Lawful becomes chaotic, good becomes evil, and vice versa. If you are true neutral or unaligned, this card has no Effect on you.’], [‘Fool’, ‘You lose 10,000 XP, discard this card, and draw from the deck again, counting both draws as one of your declared draws. If losing that much XP would cause you to lose a level, you instead lose an amount that leaves you with just enough XP to keep your level.’], [‘Jester’, ‘You gain 10,000 XP, or you can draw two additional cards beyond your declared draws.’]]

cards_and_descriptions index cheatsheet: Vizier 0, Sun 1, Moon 2, Star 3, Comet 4, Fates 5, Throne 6, Key 7, Knight 8, Gem 9, Talons 10, Void 11, Flame 12, Skull 13, Idiot 14, Donjon 15, Ruin 16, Euryale 17, Rogue 18, Balance 19, Fool 20, Jester 21

card = ‘’

description = ‘’

def card(draws):

I added the extra variable to keep track of how many draws below the specified number we are on any given round of drawing

extra = 0

This loop is what is used to generate cards

for i in range(draws):

# In ran I subtracted i from the randomly generated number so that when cards are popped from the deck you can't get a value outside the index

ran = random.randint(0,21) - i

# This if then sequence is what I used to stop the code from having an upbalanced probablity (when i is substracted from the randomly generated number sometimes you get a negative value so cards at the end of the deck had a higher probablity of being drawn.

if ran < 0:

  extra += 1


card = cards_and_descriptions[ran][0]

description = cards_and_descriptions[ran][1]

# This .pop line is what I added so that you can't generate a card multiple times. When a card is generated, it is popped from the deck