I want to make a trivia game in python. Let's say I have a set of 25 questions, how do I choose 10 random questions from that set without repeats?
tiffanynguyen08
0
Newbie Poster
Recommended Answers
Jump to Postimport random questions=open('file_containing_the_questions_separated_by_newline.txt').readlines() print random.sample(questions,10)
I want to make a trivia game in python. Let's say I have a set of 25 questions, how do I choose 10 random questions from that set without repeats?
All 3 Replies
slate
241
Posting Whiz in Training
Gribouillis
commented:
good help
+13
TrustyTony
888
pyMod
Team Colleague
Featured Poster
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.