Bird
0
0

Which of the following is the correct syntax to import the LED class from the gpiozero library?

easy📝 Syntax Q3 of 15
Raspberry Pi - gpiozero Library
Which of the following is the correct syntax to import the LED class from the gpiozero library?
Afrom gpiozero.LED import *
Bfrom gpiozero import LED
Cimport gpiozero.LED
Dimport LED from gpiozero
Step-by-Step Solution
Solution:
  1. Step 1: Recall Python import syntax for classes

    To import a class from a module, the syntax is from module import ClassName.
  2. Step 2: Match correct syntax

    from gpiozero import LED matches the correct syntax; other options are invalid or incorrect Python syntax.
  3. Final Answer:

    from gpiozero import LED -> Option B
  4. Quick Check:

    Correct import syntax = from gpiozero import LED [OK]
Quick Trick: Use 'from module import Class' to import classes [OK]
Common Mistakes:
  • Using 'import LED from gpiozero'
  • Trying to import with dot notation incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes