From 53f5cba18f40e2c83002c503ca18c0cb0823c23d Mon Sep 17 00:00:00 2001 From: Gautam Manek Date: Thu, 3 Mar 2022 16:56:26 +0100 Subject: [PATCH] fix: added docstring test for from_sequence --- data_structures/linked_list/from_sequence.py | 18 ++++++++---------- scripts/validate_filenames.py | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/data_structures/linked_list/from_sequence.py b/data_structures/linked_list/from_sequence.py index 94b44f15037f..da3016286337 100644 --- a/data_structures/linked_list/from_sequence.py +++ b/data_structures/linked_list/from_sequence.py @@ -19,8 +19,14 @@ def __repr__(self): def make_linked_list(elements_list): - """Creates a Linked List from the elements of the given sequence - (list/tuple) and returns the head of the Linked List.""" + """ + Creates a Linked List from the elements of the given sequence + (list/tuple) and returns the head of the Linked List. + >>> list_data = [1, 3, 5, 32, 44, 12, 43] + >>> linked_list = make_linked_list(list_data) + >>> print(linked_list) + <1> ---> <3> ---> <5> ---> <32> ---> <44> ---> <12> ---> <43> ---> + """ # if elements_list is empty if not elements_list: @@ -34,11 +40,3 @@ def make_linked_list(elements_list): current.next = Node(data) current = current.next return head - - -list_data = [1, 3, 5, 32, 44, 12, 43] -print(f"List: {list_data}") -print("Creating Linked List from List.") -linked_list = make_linked_list(list_data) -print("Linked List:") -print(linked_list) diff --git a/scripts/validate_filenames.py b/scripts/validate_filenames.py index ed23f3907114..b52f4f52fc2d 100755 --- a/scripts/validate_filenames.py +++ b/scripts/validate_filenames.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import os try: