Right so I was doing a quick project, and sought a quick way to finish one section of my Python code. I handed it in, but I'm well aware that it's bad code., but I was wondering if there was a good way to condense this code into fewer lines.
def nGen_army(level, strength, weakness):
if weakness == 1:
if level == 0:
army = round(random.randint(1000,5000),4)
return army
if level == 1:
army = round(random.randint(10000,25000),4)
return army
if level == 2:
army = round(random.randint(50000,75000),4)
return army
if level == 3:
army = round(random.randint(100000,200000),4)
return army
if level == 4:
army = round(random.randint(200000,500000),4)
return army
if strength == 1:
if level == 0:
army = round(random.randint(10000,25000),4)
return army
if level == 1:
army = round(random.randint(50000,100000),4)
return army
if level == 2:
army = round(random.randint(100000,300000),4)
return army
if level == 3:
army = round(random.randint(300000,800000),4)
return army
if level == 4:
army = round(random.randint(800000,1100000),4)
return army
else:
if level == 0:
army = round(random.randint(5000,10000),4)
return army
if level == 1:
army = round(random.randint(25000,50000),4)
return army
if level == 2:
army = round(random.randint(75000,150000),4)
return army
if level == 3:
army = round(random.randint(150000,250000),4)
return army
if level == 4:
army = round(random.randint(300000,900000),4)
return army