0% found this document useful (0 votes)
2 views5 pages

Def Chatbot

The document contains multiple programs written by Manya, a 3rd B.C.A student, all focused on sorting a list of N elements using the selection sort technique. Additionally, it includes a chatbot implementation that responds to user input and a breadth-first search (BFS) algorithm for traversing a graph. The date of all programs is noted as 19-08-2005.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views5 pages

Def Chatbot

The document contains multiple programs written by Manya, a 3rd B.C.A student, all focused on sorting a list of N elements using the selection sort technique. Additionally, it includes a chatbot implementation that responds to user input and a breadth-first search (BFS) algorithm for traversing a graph. The date of all programs is noted as 19-08-2005.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Program:01

Title:write a program to sort a list of N elements using selection sort technique


Name:Manya
Class:3rd B.C.A
Date:19-08-2005
Program:02
Title:write a program to sort a list of N elements using selection sort technique
Name:Manya
Class:3rd B.C.A
Date:19-08-2005
Program:03
Title:write a program to sort a list of N elements using selection sort technique
Name:Manya
Class:3rd B.C.A
Date:19-08-2005

>>> def chatbot():

While True:

Text = input("You:")lower()

if "hello"in text:

print("AI:Hi there!")

elif"bye"in text:

print("AI,Good bye!")

break

else:

print("AI:I don't understand:")

Chat bot()
Program:04
Title:write a program to sort a list of N elements using selection sort technique
Name:Manya
Class:3rd B.C.A
Date:19-08-2005

from queue import Queue

def bfs(graph , start , gaol):

visited=set()

queue=Queue()

[Link] ([start]) # start with a path containing only the start node

while not [Link]():

path=[Link]() # Get the current path

node=path[-1] #Get the last node in the path

if node == goal:

return path # Return the path if goal is reached

if node not in visited:

visited .add(node) # Mark the node as visited

for neighbor in [Link](node,[1]):# Iterate over neighbors

new_path= List (path) # copy the current path

new_path.append(neighbor) # Append the new node

[Link] (new_path) # Add new path to the queue

return None # If no path is found

You might also like