Question: Task 2 ( of 2 ) : Knowing your team A set of questions were generated by a Generative AI and then saved to the
Task of : Knowing your team
A set of questions were generated by a Generative AI and then saved to the following file:
TeamQuestion.txt This file consists of a large number of possible questions. You are asked to
write a Python script HWpTaskUCusername.py to randomly extract questions from this
file. At the beginning of your script, an input statement should be used to ask the user how many
questions to extract. Then, the script should open the TeamQuestion.txt file, use a random number
generator to identify a random question, print the random question to the python shell and then
have an input statement to ask if the printed question should be used. If the answer is yes, the
question should be written to a new file QuestionsToAsktxt If the user does not want the
question asked, nothing should be written to the new file. The program should then loop around
and identify a new random question until questions have been accepted.
To identify a random line, you will need to have the following lines in your code:
import random
LineSelect random randint NumberOfLines
Where Number of lines is the total number of Questions in the TeamQuestion.txt file. Line select
will then be the extracted line from the TeamQuestion.txt
The example below is done using the random line select option, thus your script will not identify
the same questions, but should be in a similar format.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
