I'm currently creating a card came in python and in creating my draft() function used for drafting the player a deck I encountered a problem with my while loop.
I can't seem to figure out why the while loop doesn't loop.
If anyone can figure out why please do let me know.
player_deck = []
#draft function to draft a player deck should be used when starting game
def draft():
while len(player_deck) < 10:
random_variable = random.random()
if random_variable < 0.2:
print("Your choise is between Drake and Recovery")
print("---> " + drake.description)
print("---> " + recovery.description)
player_choice = input("Which do you choose: ")
if player_choice.lower() == "drake":
player_deck.append(drake)
if player_choice.lower() == "recovery":
player_deck.append(recovery)
else:
return "Please pick one of the two"
if random_variable >= 0.2 and random_variable <= 0.999999:
print("Your choise is between Blast Cone and Eminem")
print("---> " + blast_cone.description)
print("---> " + eminem.description)
player_choice = input("Which do you choose: ")
if player_choice.lower() == "blast cone":
player_deck.append(blast_cone)
if player_choice.lower() == "eminem":
player_deck.append(eminem)
else:
return "Please pick one of the two"
return player_deck
print(draft())
ifchecks forplayer_choiceshould be changed toif/elif/else. Right now your function will return if the player chooses the first option