()
| 492 | |
| 493 | |
| 494 | def main(): |
| 495 | from doctest import testmod |
| 496 | |
| 497 | testmod() |
| 498 | |
| 499 | linked_list = LinkedList() |
| 500 | linked_list.insert_head(input("Inserting 1st at head ").strip()) |
| 501 | linked_list.insert_head(input("Inserting 2nd at head ").strip()) |
| 502 | print("\nPrint list:") |
| 503 | linked_list.print_list() |
| 504 | linked_list.insert_tail(input("\nInserting 1st at tail ").strip()) |
| 505 | linked_list.insert_tail(input("Inserting 2nd at tail ").strip()) |
| 506 | print("\nPrint list:") |
| 507 | linked_list.print_list() |
| 508 | print("\nDelete head") |
| 509 | linked_list.delete_head() |
| 510 | print("Delete tail") |
| 511 | linked_list.delete_tail() |
| 512 | print("\nPrint list:") |
| 513 | linked_list.print_list() |
| 514 | print("\nReverse linked list") |
| 515 | linked_list.reverse() |
| 516 | print("\nPrint list:") |
| 517 | linked_list.print_list() |
| 518 | print("\nString representation of linked list:") |
| 519 | print(linked_list) |
| 520 | print("\nReading/changing Node data using indexing:") |
| 521 | print(f"Element at Position 1: {linked_list[1]}") |
| 522 | linked_list[1] = input("Enter New Value: ").strip() |
| 523 | print("New list:") |
| 524 | print(linked_list) |
| 525 | print(f"length of linked_list is : {len(linked_list)}") |
| 526 | |
| 527 | |
| 528 | if __name__ == "__main__": |
no test coverage detected