I'm writing a program for myself that generates a loadout for this game I play. I'm nearly done, I switched from using random.choice to random.sample in order to avoid have repeats in the results but hate the formatting.
print("He has", random.choice(kills) + ',', random.choice(kills) + ',', random.choice(kills) + ', and', random.choice(kills)) Outputs: He has Two Handed Choke, Skewer, Skewer, and Pitchfork Stab
whereas: print("He has", random.sample(kills, 4)) Outputs: He has ['Knee Snap', 'Jaw Rip', 'Body Slam', 'Choke']
How do I get a sample that outputs like the code for random.choice()? Thanks!
Aucun commentaire:
Enregistrer un commentaire