Professional Documents
Culture Documents
Objective
Prerequisite Theory
Basic knowledge of Python programming.
def chatbot_response(user_input):
if "hello" in user_input.lower():
return "Hello! How can I assist you today?"
elif "how are you" in user_input.lower():
return "I'm just a Chatbot, but I'm here to help you!"
elif "bye" in user_input.lower():
return "Goodbye! Have a great day!"
else:
return "I'm sorry, I don't understand that."
if __name__ == "__main__":
print("Chatbot: Hello! How can I assist you today?")
while True:
user_input = input("You: ")
if user_input.lower() == "exit":
break
response = chatbot_response(user_input)
print("Chatbot:", response)
OUTPUT:
Write any two Program of Following
while queue:
# Dequeue a vertex from the queue
vertex = queue.popleft()
print(vertex, end=' ')
# Example usage:
# Define a graph as an adjacency list
graph = {
'A': ['B', 'C'],
'B': ['A', 'D', 'E'],
'C': ['A', 'F'],
'D': ['B'],
'E': ['B', 'F'],
'F': ['C', 'E']
}
OUTPUT:-
2. Analyze the generated algorithms and discuss their efficiency and correctness.
(BREADTH FIRST SEARCH)
INPUT:-
from collections import deque
while queue:
vertex = queue.popleft()
if vertex == target:
return True # Target found
for neighbor in graph[vertex]:
if neighbor not in visited:
queue.append(neighbor)
visited.add(neighbor)
# Example usage:
graph = {
'A': ['B', 'C'],
'B': ['A', 'D', 'E'],
'C': ['A', 'F'],
'D': ['B'],
'E': ['B', 'F'],
'F': ['C', 'E']
}
start_node = 'A'
target_node = 'F'
OUTPUT:-
MANUALLY :-
from collections import deque
while queue:
node = queue.popleft()
print(node, end=' ')
start_node = 'A'
print("Breadth-First Search starting from node", start_node)
bfs(graph, start_node)
OUTPUT:-
CHATGPT:-
from collections import deque
while queue:
vertex = queue.popleft()
print(vertex, end=' ')
# Example usage:
graph = {
'A': ['B', 'C'],
'B': ['A', 'D', 'E'],
'C': ['A', 'F'],
'D': ['B'],
'E': ['B', 'F'],
'F': ['C', 'E']
}
start_node = 'A'
print("Breadth-First Search starting from node", start_node)
bfs(graph, start_node)
OUTPUT:-
Conclusion-
Hence, We perform Python program to remove stop words from a given passage from a text file using
NLTK.
Progressive Assessment Sheet as per Rubrics
Regular Level of
Attendance Presentation Total
Assessment Understanding
05 05 07 08 25
Sign : Date: