mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-04-20 12:47:35 +00:00
Corrected errors in ruff test
This commit is contained in:
parent
0a1c71e34d
commit
4ae57dc896
@ -1,6 +1,5 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import Iterator
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -17,7 +16,7 @@ class Node:
|
|||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
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
|
||||||
@ -191,7 +190,7 @@ class SortedLinedList:
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
linkedList=SortedLinedList()
|
linked_list=SortedLinkedList()
|
||||||
while True:
|
while True:
|
||||||
print("Enter")
|
print("Enter")
|
||||||
print("1. Insert")
|
print("1. Insert")
|
||||||
@ -202,15 +201,15 @@ 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 linkedList.delete(data):
|
if linked_list.delete(data):
|
||||||
print("Node with data {} deleted successfully".format(data))
|
print(f"Node with data {data} deleted successfully")
|
||||||
else:
|
else:
|
||||||
print("Node with data {} not found in the list".format(data))
|
print(f"Node with data {data} not found in the list")
|
||||||
elif choice == '4':
|
elif choice == '4':
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user