MCQ Answer

random.shuffle() function shuffle value of

random.shuffle() function shuffle value of

random.shuffle() फंक्शन किसकी वैल्यू को शफल करता है
Topic : Modules in Python

A. take a sequence, like a list, and arrange the items in ascending order

B. take a sequence, like a list, and reorganize the order of the items.

C. take a sequence, like a list, and arrange the items in descending

D. take a sequence, like a list, and return the same copy of sequence




Correct Answer is :

B. take a sequence, like a list, and reorganize the order of the items.



Explanation

the shuffle() function is part of the random module and is used to randomly shuffle the elements of a sequence in place. This function modifies the sequence directly and does not return a new shuffled sequence.

Example:

import random
# Create a list
my_list = [1, 2, 3, 4, 5]
# Shuffle the list in place
random.shuffle(my_list)
# Print the shuffled list
print("Shuffled List:", my_list)
CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz