Objective
The import statement needs the module name written in the code. When the name is only known while the program runs, you use importlib.import_module.
Instructions
- Read
nand thennlines with the formatmodule function arg1 arg2 .... - Import the module with
importlib.import_module(name)and get the function withgetattr(module, function_name, None). - Convert the arguments to
intif possible and, if not, tofloat, and show the result of calling the function with them. - If the module does not exist (
ModuleNotFoundError) showModule not found. If the module exists but does not have that function, showFunction not found.
3
math sqrt 16
operator add 2 3
math gcd 12 18
4.0
5
6
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise