I need to set up a code that has a 50% chance of selecting the first character of the mother string or the first character of the father string and add it to the child string, and so on for each letter.
import random
mama_string = "0>Y!j~K:bv9\Y,2"
papa_string = "OkEK=gS<mO%DnD{"
child = ""
while len(child) < 15:
random_number = random.randint(0,100)
if random_number <= 50:
for mama_char in mama_string:
child += mama_char
break
if random_number > 50:
for papa_char in papa_string:
child += papa_char
break
Aucun commentaire:
Enregistrer un commentaire