• [deleted]
    + 15 comments

    To summarise:

    We're comparing user input to a set of conditions we've set out in our program. If the input matches the conditions, the program will print a message. A basic example of an if statement would be:

    if (1 >= 0):
       return "Spam"
    

    With regard to the question however, we're given multiple conditions and our program has to respond to those conditions as such. There are three outputs that expect a "Weird" output so we'll do a single if statement to address that

    if (n in range (6, 21) or n % 2 != 0):
            return "Weird"
    

    Firstly, we are saying if n is between the range of 6 and 21 (21 is not counted) print "Weird", we're also saying that if n is not an even number -- print the same result.

    Lastly, we can just use an else statement to print off any remaining statements if none of test cases matched the previous conditions.

    else:
            return "Weird"
    

    And that's it, really. Best of luck!