This is a function.
def cut_dk(): a = []; b = [] random.shuffle(deck__) slice = deck__[:2] a.append(slice[0]) b.append(slice[1]) return a,b c = cut_dk() p1 = c[0] p2 = c[1]
I have this function at the top of the program along with other functions. It draws from a predefined list. When calling this function dynamically in the program it returns the same variables. It's the cutting of a card deck (two cards, highest wins the draw), when the cards are equal it needs to draw again (this is the problem, a second draw), a new selection from the list, yet it just repeats the variables it has in memory.
Calling the function again in a conditional statement just returns the same initial variables acquired on the first run, so I am unable to repeat the cut dynamically as part of the game play.
https://stackoverflow.com/questions/66978492/how-to-get-a-function-to-run-twice-dynamically April 07, 2021 at 09:42AM
没有评论:
发表评论