Question: To create a module, first check if the module already exists. If it exists, then create the module with a different name. Import the musicalnote

To create a module, first check if the module already exists. If it exists, then create the module with a different name.
Import the musicalnote module, as shown in Snippet 8.3:
>>> import musicalnote
Snippet 8.3
The error message is shown in Snippet 8.4:
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'musicalnote'
Snippet 8.4
The module does not exist; now create a module with the name musicalnote.
Create a file musicalnote.py that prints the different lengths of musical notes. The file is shown in Snippet 8.5:
def listnote():
print("Whole note, Half note, Quarter note, Eighth note, and Sixteenth note")
Snippet 8.5
Import the module and print the values as shown in Snippet 8.6:
>>> import musicalnote
>>> musicalnote.listnote()
Snippet 8.6
The output is as shown in Snippet 8.7:
Whole note, Half note, Quarter note, Eighth note, and Sixteenth note
Snippet 8.7
We have successfully created a new module musicalnote which prints the name of the musical notes.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!