Search⌘ K
AI Features

Quiz: Managing Packages and Environments

Validate your mastery of Python packaging, secure configuration, and virtual environments through fifteen applied scenarios.

We'll cover the following...
Technical Quiz
1.

You have a project structure:

my_project/
    main.py
    utils/
        __init__.py
        network.py
        db.py

In utils/__init__.py, you have the following line:

from . import network

In main.py, you run:

import utils
print(utils.network.CONNECT_TIMEOUT)

What happens when you run main.py?

A.

It runs successfully and prints the value of CONNECT_TIMEOUT.

B.

It raises an ImportError because relative imports are not allowed in __init__.py.

C.

It raises an AttributeError because utils has no attribute network.

D.

It raises a NameError because network is not defined in main.py.


1 / 9
...