Why does importing from random in python give me back unused import statement?
Question:
When I type for ex:
from random import shuffle
I get:
Unused import statement ‘from random import shuffle’
in return and the letter go grey. Can anybody diagnose?
I tried "from random import shuffle" and was expecting to be able to use shuffle
Answers:
Without seeing the rest of the code I think that the error description is correct. Your import is unused. That means that you imported it but in the actual script the shuffle function was never accessed.
Try using it in your code:
from random import shuffle
my_shuffled_number = shuffle([1, 2, 3, 4, 5])
print(my_shuffled_number)
This small script makes use of the import function.
When I type for ex:
from random import shuffle
I get:
Unused import statement ‘from random import shuffle’
in return and the letter go grey. Can anybody diagnose?
I tried "from random import shuffle" and was expecting to be able to use shuffle
Without seeing the rest of the code I think that the error description is correct. Your import is unused. That means that you imported it but in the actual script the shuffle function was never accessed.
Try using it in your code:
from random import shuffle
my_shuffled_number = shuffle([1, 2, 3, 4, 5])
print(my_shuffled_number)
This small script makes use of the import function.