Python- How can I randomise questions that have an A,B,C,D

后端 未结 4 608
旧时难觅i
旧时难觅i 2020-12-22 13:40

My aim is to have it so it can randomise questions.

For example, the test starts and the first question could be question 8. The word Question is only

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-22 14:10

    you can do simple one pulling information from files like so,

    while count < 10:
    wordnum = random.randint(0, len(questionsfile)-1)
    print 'What is:  ', answersfile[wordnum], ''
    options = [random.randint(0, len(F2c)-1),
        random.randint(0, len(answersfile)-1),random.randint(0, len(answersfile)-1)]
    options[random.randint(0, 2)] = wordnum
    print '1 -', answersfile[options[0]],
    print '2 -', answersfile[options[1]],
    print '3 -', answersfile[options[2]],
    print '4 -', answersfile[options[3]]
    answer = input('\nYou  choose number ?: ')
    if options[answer-1] == wordnum:
    

提交回复
热议问题