Skills101
← All practice quizzes

Quiz: Python Conditions

5 questionsNo time limitPass: 60%+10 XP on first pass

Make decisions in code. if, elif and else with a flowchart, combining conditions, nested ifs, the one-line conditional expression, and match-case.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    What does this print?

    x = 15
    if x > 10:
        print("A")
    elif x > 5:
        print("B")
    else:
        print("C")
    
  2. Question 2

    What does this print?

    n = 0
    print("yes" if n else "no")
    
  3. Question 3

    Which condition checks that age is between 18 and 30, inclusive?

  4. Question 4

    What is wrong with this code?

    if marks >= 40
        print("Pass")
    
  5. Question 5

    Is 1900 a leap year according to the rule (year % 4 == 0 and year % 100 != 0) or year % 400 == 0?