Python

Solved




Hello, I have a little problem... In my homework, we are asked to randomly choose 10 questions and they should not repeat. I can't manage to do it, so thank you for helping me!!!

9 answers

  1. Moderator
    Well!!!

    As I pointed out earlier, your code has 180 lines; we should be able to do the same thing in 25 lines ;-)

    You repeat the same sequence 14 times for each question; the essence of a programmer's job is not to do the work but to make the computer do it. These 14 sequences could form a single repeated loop. As yg_be pointed out, you need to work on using loops with simple examples, codes with 5/6 lines to clearly see how it works.

    And for example, a really simple thing, we shouldn't have to deal with lowercase and uppercase.
    if Q14.lower() == "c": 
    and
    start.lower() == "yes":
    will handle all forms of the response, saving lines.

    0