print(“BATTLE FIELD”)
def roll_dice(sides)
import random
n = random.randint(1,sides)
name = input("Name: ")
type = input("Type: ")
def stats_c1():
health = ((roll_dice(6) * roll_dice(8))/2) + 10
strength = ((roll_dice(6) * roll_dice(12))/2) + 12
print("Health: ", health)
print("Strength: ", strength)
stats_c1()
name_c2 = input("Name: ")
type_c2 = input("Type: ")
def stats_c2():
health = ((roll_dice(6) * roll_dice(8))/2) + 10
strength = ((roll_dice(6) * roll_dice(12))/2) + 12
print("Health: ", health)
print("Strength: ", strength)
stats_c2()
Python Interpreter isn’t running the health and strength subroutines.
I expected that two Characters would be generated in console, with their user defined ‘name’ and ‘type’ along with randomnly generated health and strength of both characters.
But instead it is just asking me to enter the name and type of characters.
How do I fix this problem ?
New contributor
Dhruv Khajanchi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.