Question: 3) Not all objects are imported with *. For this exercise, create two modules (Q3_names_local.py, Q3_test_names_local.py) For the Q3_names_local.py, enter the following codes _version =
3) Not all objects are imported with *. For this exercise, create two modules (Q3_names_local.py, Q3_test_names_local.py) For the Q3_names_local.py, enter the following codes _version = 1.0 def show_names(names): for i in names: print(i, end= ', ') def _show_version(): print(_version) For the Q3_test_names_local.py, enter the following codes: ''' This program demonstrates the properties of import (names_local), and using locals( ) to return the dictionary of the current local symbol table and the local symbol table. ''' import textwrap from Q3_names_local import * # have to enter the following explicitly from Q3_names_local import _version, _show_version names = ["Brianna", "Nicholas", "Julia", "Veronica", "Christian", "Jimmy", "Tyler", "Hanna", "Jazmin"] dnames = ', '.join(locals()) # construct the symbol table. print('with textwrap to display python symbol,, ',textwrap.fill(dnames)) show_names(names) _show_version()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
