I am trying Vegaseat's suggestion in one of my threads to use shuffled lists for combat in my text adventure. He suggested creating two lists,
myhit_list[1, 0, 2, 0, 3, 0, 0, 1] and monsterhit_list[1, 0, 2, 0, 3, 0, 0, 1] and using random.shuffle(myhit_list) and random.shuffle(monsterhit_list) iterated with "I hit him" and "he hit me" for loops.
My question is the method of creating this. First, do I create them as globals or as functions? In my understanding a global is a variable that stays consistant throughout every function in the program. Is that correct?
Second, my understanding of a function is a defined mini-program type that allows you to utilize one statement in replace of lengthy codes. Is that anywhere near correct?
And third, is there a website that breaks down Python statements and explains every part of them? Such as what "[" means compared to "(", why it is used where and all that great stuff? I am really interested in getting a more scientific explaination of python code.