#
)def hello():
# This is a simple comment that is preceding the print statement
print("Hello 4061CEM")
__doc__
help()
functiondef hello_person(name: str) -> str:
return f"Hello {name}, welcome to 4061CEM!"
hello_person.__doc__ = """A function that says "Hello" to the user
and welcomes them to the module."""
Help on function hello_person in module main:
hello_person(name: str) -> str A function that says “Hello” to the user and welcomes them to the module.
"""
)
__init__()
function docstringclass Dog:
"""
A class used to represent a dog.
...
Attributes
----------
says_str : str
a formatted string to print out what the dog says
name : str
the name of the dog
sound : str
the sound that the dog makes
legs : int
the number of legs the animal has (default is 4)
Methods
-------
says(sound=None)
Prints the dogs name and the sound it makes
"""
says_str = "A {name} says {sound}"
def __init__(self, name, sound, legs=4):
"""
Parameters
----------
name : str
The name of the dog
sound : str
The sound that the dog makes
legs : int, optional
The number of legs the animal has (default is 4)
"""
self.name = name
self.sound = sound
self.legs = legs
def says(self, sound=None):
"""Prints what the dogs name is and what sound it makes.
If the argument `sound` is not passed in, then the default dog
sound is used.
Parameters
----------
sound : str, optional
The sound the dog makes (default is None)
Raises
------
NotImplementedError
If no sound is set for the dog or passed in as a
parameter.
"""
if self.sound is None and sound is None:
raise NotImplementedError("Silent dogs are not supported!")
out_sound = self.sound if sound is None else sound
print(self.says_str.format(name=self.name, sound=out_sound))
__init__.py
file
-h
option"""Gets and prints the spreadsheet's header columns
:param file_loc: The file location of the spreadsheet
:type file_loc: str
:param print_cols: A flag used to print the columns to the console
(default is False)
:type print_cols: bool
:returns: a list of strings representing the header columns
:rtype: list
"""
"""Gets and prints the spreadsheet's header columns
@type file_loc: str
@param file_loc: The file location of the spreadsheet
@type print_cols: bool
@param print_cols: A flag used to print the columns to the console
(default is False)
@rtype: list
@returns: a list of strings representing the header columns
"""