Python beginners

Test your basic Python knowledge with this quick 10-question quiz.

  • Question of

    What is the output of print(2 * 3)?

    • a) 6
    • b) 23
    • c) 5
    • d) Error
  • Question of

    Which keyword defines a function in Python?

    • a) func
    • b) def
    • c) function
    • d) define
  • Question of

    How do you create a list in Python?

    • a) (1, 2, 3)
    • b) {1, 2, 3}
    • c) [1, 2, 3]
    • d) <1, 2, 3>
  • Question of

    What does len(“Hello”) return?

    • a) 5
    • b) “H”
    • c) “Hello”
    • d) 6
  • Question of

    Which operator checks equality in Python?

    • a) =
    • b) ==
    • c) !=
    • d) ===
  • Question of

    What is the result of “hi” * 2?

    • a) “hihi”
    • b) “hi2”
    • c) “hihihi”
    • d) Error
  • Question of

    Which data type is mutable?

    • a) tuple
    • b) int
    • c) list
    • d) str
  • Question of

    How do you start a for loop from 0 to 4?

    • a) for i in 5:
    • b) for i in range(5):
    • c) for i in (0, 4):
    • d) for i = 0 to 4:
  • Question of

    Which method adds an item to a list?

    • a) .append()
    • b) .add()
    • c) .insert()
    • d) .push()
  • Question of

    What does “hello”.upper() return?

    • a) “HELLO”
    • b) “Hello”
    • c) “hello”
    • d) “hELLO”

This post was created with our nice and easy submission form. Create your post!

What do you think?

Written by Saba Khalil

Leave a Reply

Your email address will not be published. Required fields are marked *

GIPHY App Key not set. Please check settings

The History of Machine Learning: A Complete Timeline of Key Breakthroughs

The Role of Data in Machine Learning: It’s More Than Just Fuel