Use of the exec statement could be dangerous, and should be avoided. Moreover, the exec statement was removed in Python 3.0. Instead, the built-in exec() function can be used.

Noncompliant Code Example

exec 'print 1' # Noncompliant

Compliant Solution

exec('print 1')