20 lines
855 B
Python
20 lines
855 B
Python
import random
|
|
import pl_stat
|
|
|
|
def generate_planet():
|
|
planet_type_generation = random.choice(list(pl_stat.planet_type.keys()))
|
|
planet_name = random.choice(pl_stat.planet_name_prefix) + random.choice(pl_stat.planet_name_sufix)
|
|
planet_population_people = random.choice(pl_stat.planet_population_type)
|
|
planet_population_number = pl_stat.planet_type[planet_type_generation]["population"] * random.randrange(5, 15) / 10
|
|
|
|
planet_description = (f"Planète : {planet_name}\nType : {planet_type_generation}\nPopulation : \n {planet_population_number} milliards\n Majoritairement {planet_population_people}")
|
|
return planet_description
|
|
|
|
def planet_loop(number):
|
|
count = 0
|
|
while count < number:
|
|
planet = generate_planet()
|
|
print("\n" + planet + "\n\n------------------------------")
|
|
count += 1
|
|
|
|
planet_loop(5) |