Feb-05-2020, 07:31 AM
First of all i apologize if a make any grammar mistakes English is not my native language.
I'm new to python and i have the following dilemma:
How do i print a random number set let's say 30 characters long without any repetitions.
This is the code that i have:
Hope you can help.
Thank you
I'm new to python and i have the following dilemma:
How do i print a random number set let's say 30 characters long without any repetitions.
This is the code that i have:
import random mylist = [] for i in range(30): x = random.randint (1,100) if x not in mylist: mylist.append(x) print (mylist)This prints only one line and i want it to print 30, but the code also removes the duplicates and i end up with 27 or 26 numbers.
Hope you can help.
Thank you