mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-04-17 11:17:36 +00:00
Errors from ruff tests solved
This commit is contained in:
parent
01dfb178b2
commit
187f4da98a
@ -18,7 +18,7 @@ class Node:
|
|||||||
return f"Node({self.data}, {self.next_node})"
|
return f"Node({self.data}, {self.next_node})"
|
||||||
|
|
||||||
|
|
||||||
class SortedLinedList:
|
class SortedLinkedList:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.numNodes: int = 0
|
self.numNodes: int = 0
|
||||||
self.head: Node | None = None
|
self.head: Node | None = None
|
||||||
@ -130,7 +130,7 @@ class SortedLinedList:
|
|||||||
Returns:
|
Returns:
|
||||||
int: The length of linked list
|
int: The length of linked list
|
||||||
"""
|
"""
|
||||||
return numNodes
|
return self.numNodes
|
||||||
|
|
||||||
def min_value(self) -> int | None:
|
def min_value(self) -> int | None:
|
||||||
"""This function will return minimum value
|
"""This function will return minimum value
|
||||||
@ -190,7 +190,7 @@ class SortedLinedList:
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
linkedList = SortedLinedList()
|
linked_list = SortedLinedList()
|
||||||
while True:
|
while True:
|
||||||
print("Enter")
|
print("Enter")
|
||||||
print("1. Insert")
|
print("1. Insert")
|
||||||
@ -201,9 +201,9 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
if choice == "1":
|
if choice == "1":
|
||||||
data = int(input("Enter a number: "))
|
data = int(input("Enter a number: "))
|
||||||
linkedList.insert(data)
|
linked_list.insert(data)
|
||||||
elif choice == "2":
|
elif choice == "2":
|
||||||
linkedList.display()
|
linked_list.display()
|
||||||
elif choice == "3":
|
elif choice == "3":
|
||||||
data = int(input("Enter the data to delete: "))
|
data = int(input("Enter the data to delete: "))
|
||||||
if linked_list.delete(data):
|
if linked_list.delete(data):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user