Copyleft Games

Intro to Python documentation (sound)

Documentation is vitally important for every software project. In this beginner task you'll demonstrate that you've learned to document a small Python function to play a sound:

def play_sound(file, volume):
    previous_volume = audio.volume
    audio.volume = volume
    audio.play(file)
    # restore previous volume
    audio.volume = previous_volume

Add a concise description for this function and its two arguments, a file name and a float between 0 and 10. If you're unfamiliar with Python you may need to research how to do this or ask for guidance in our webchat.

Submit the above function with your added annotations and documentation when you're done.

Task tags

  • pydoc

Students who completed this task

CT310

Task type

  • chrome_reader_mode Documentation / Training

Level

Beginner
close

2019