jeudi 14 juin 2018

python 3x Save and call random variables

I've very recently started to learn python so please forgive the novice level of my question.

I'm attempting to have my code create a number of random values, save those values, then allow me to manipulate those random values to create a number of profiles.

I'm currently finding issues with both saving the numbers and finding issues with global and local values

I have this so far (And fully apologize for this layout)

import random

HP = random.randint(30,70)
Strength = random.randint (30,70)       

M_HP = random.randint(30,70)-10
M_Strength = random.randint (30,70)-10


def pilot_print():
    print ("Your pilot HP is " +str(HP))
    print ("Your pilot Strength is " +str(Strength))

def mech_print():
    print ("Your Mech HP is " +str(M_HP))
    print ("Your Mech Strength is " +str(M_Strength))

My issue is that I'm also attempting to put something like

def combine():
    HP+(M_HP/2) = C_HP
    Strength+(M_Strength/2) = C_Strength

My aim is to eventually create a game with character profiles generated randomly.

Would anyone be kind enough to point me in the right direction? Thank you




Aucun commentaire:

Enregistrer un commentaire