0

How do I code in python to get different random outputs for the same input?

11th May 2017, 6:38 AM
Bishal Bimal
Bishal Bimal - avatar
2 Réponses
+ 3
You must be more accurate in your description, if you don't want to get blurred answers :P Anyway, you can even get different random outputs without input: from random import * letters = ' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' for count in range(5): # arbitrary number of outputs string = '' length = randint(10,20) # arbitrary length bounds for char in range(length): string += choice(letters) print(str(count)+'> '+string)
11th May 2017, 9:34 AM
visph
visph - avatar
0
use random module
11th May 2017, 8:00 AM
Vishal Prajapati