back with more issues

Kris Mesenbrink krismesenbrink at gmail.com
Sun Aug 11 23:33:47 EDT 2013


import random

def player():
    hp = 10
    speed = 5
    attack = random.randint(0,5)

def monster ():
    hp = 10
    speed = 4

def battle(player):
    print ("a wild mosnter appered!")
    print ("would you like to battle?")
    answer = input()
    if answer == ("yes"):
        return player(attack)
    else:
        print("nope")


battle()


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

this was a variation on a code that you guys already had helped me with,in the long run i plan to incorporate them together but as it stand i don't know how to call a specific variable from one function (attack from player) to use in another function (battle). what i want is to be able to use the variables from both player and monster to use in battle. any idea's?



More information about the Python-list mailing list