mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-03-13 09:50:19 +08:00
GitHub Action formats our code with psf/black (#1569)
* GitHub Action formats our code with psf/black @poyea Your review please. * fixup! Format Python code with psf/black push
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
# Program to print the elements of a linked list in reverse
|
||||
|
||||
|
||||
class Node:
|
||||
def __init__(self, data=None):
|
||||
self.data = data
|
||||
@@ -16,7 +17,6 @@ class Node:
|
||||
return string_rep
|
||||
|
||||
|
||||
|
||||
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."""
|
||||
@@ -34,6 +34,7 @@ def make_linked_list(elements_list):
|
||||
current = current.next
|
||||
return head
|
||||
|
||||
|
||||
def print_reverse(head_node):
|
||||
"""Prints the elements of the given Linked List in reverse order"""
|
||||
|
||||
@@ -46,8 +47,7 @@ def print_reverse(head_node):
|
||||
print(head_node.data)
|
||||
|
||||
|
||||
|
||||
list_data = [14,52,14,12,43]
|
||||
list_data = [14, 52, 14, 12, 43]
|
||||
linked_list = make_linked_list(list_data)
|
||||
print("Linked List:")
|
||||
print(linked_list)
|
||||
|
||||
Reference in New Issue
Block a user