I’d like the reviewers to focus especially on the final recommendation(and reasoning) I’ve arrived after the analysis and would want to know if the conclusion I’ve made is correct. I was pretty confused, especially after looking at the solution that is provided.
Looking forward to your valuable inputs and comments.
I really like how you have described the whole thing. You have even given a description of the explore_data() function.
Here’s my suggestion that might be useful the next time you are trying to describe your functions - create a doctring. Python docstrings are documentation strings that are used to describe a class, module or a function. So, here’s how your function would look like with docstring:
def explore_data(dataset, start, end, rows_and_columns=False):
"""
Helps in exploring datasets.
:param dataset: list of lists
:param start: integer representing the starting index of a slice from the dataset
:param end: integer representing the ending index of a slice from the dataset
:param rows_and_columns: boolean with False as default
"""
dataset_slice = dataset[start:end]
for row in dataset_slice:
print(row)
print('\n') # adds a new (empty) line after each row
if rows_and_columns:
print('Number of rows:', len(dataset))
print('Number of columns:', len(dataset[0]))
As far as the final recommendation goes, I think it’s fine as long as it is backed up with a reasoning (which it is, in your case!).