Ok im trying to make a small text based game for school and i made a tiny talents generator as a def function. The problem is that im not able to use the value in another def function and i dont know how. Here's the generator:
def player_dexterite():
dexterite = random.randrange(0, 26)
print("Votre dextérité est de: " + str(dexterite))
if dexterite > 20:
print("Bravo vous êtes très vif! ")
player_choice2()
elif dexterite > 15:
print("Vous êtes plutôt vif. ")
player_choice2()
elif dexterite > 10:
print("Ça pourrais être mieux. ")
player_choice2()
elif dexterite > 5:
print("Dommage meilleure chance la prochaine fois... ")
player_choice2()
elif dexterite < 5:
print("Bonne chance vous aller en avoir besoin! ")
player_choice2()
And here's the part where i need the random value:
def armory_1():
print("Apres environ 100 metre de marche vous entrez dans une piece avec un coffre et une étagère. ")
print("Une voix vous dit que vous ne pouvez choisir qu'un seul de deux. ")
choix_2 = input("Voulez vous ouvrir le coffre ou l'étagère?/n (c ou e). ")
if choix_2 == "c":
print("Dans le coffre vous trouvez une simple épée, une cotte de maille et une corde.")
way_1()
elif choix_2 == "e":
print("En ouvrant l'étagere une dizaine de serpents vous tombe dessus. (Nécessite +15 dext pour éviter)")
if player_dexterite() > 14:
print("Mais heureusement vous êtes assez rapide pour les éviter en courant vers la suite du labyrinthe. ")
way_1()
elif player_dexterite() < 15:
print("Vous n'êtes malheureusement pas asser rapide pour les éviter et mourrez empoisonné. ")
death_2()
I need to use the value at if player_dexterite() > 14: and elif player_dexterite() < 15:. What can i do?
P.S.: I talk french thats why the story is in french but i prefer to code in partial english.
Thanks for your time.