Python - Standard Library Usage
What is the output of this code?
import random items = ['apple', 'banana', 'cherry'] random.shuffle(items) print(items)
import random items = ['apple', 'banana', 'cherry'] random.shuffle(items) print(items)
random.shuffle rearranges the list elements in place randomly. It does not return a new list.items shows the same list but with elements in random order. So output is a shuffled list, not the original order or a single item.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions