0

Is there an alternative module for Python 'random' library..Also i'm getting an error while using random.choice keyword. error i

This is how i imported random module : from random import choice,choices,random,randint Error i got : playsound.playsound(random.choice(beatboxes)) AttributeError: 'builtin_function_or_method' object has no attribute 'choice'

15th Feb 2021, 8:46 AM
Rohan Kishore
Rohan Kishore - avatar
2 Réponses
+ 4
if you import specific methods from a library, you can only access the specific methods you imported. If you want the code to work: - either just use, import random - or lose the "random." before "choice"
15th Feb 2021, 8:50 AM
Slick
Slick - avatar
+ 1
No prob guys.. the problem is solved now
15th Feb 2021, 9:45 AM
Rohan Kishore
Rohan Kishore - avatar