NAME : SINDHUJA
ROLL NO : 160123862014
SUBJECT : PYTHON PROGRAMMING
ASSIGNMENT -||
def determine_blooms_level(question):
levels = {
'knowledge': ['define', 'identify', 'list', 'name', 'state'],
'comprehension': ['describe', 'explain', 'interpret', 'summarize', 'classify'],
'application': ['apply', 'demonstrate', 'solve', 'use', 'illustrate'],
'analysis': ['analyze', 'compare', 'contrast', 'differentiate', 'organize'],
'synthesis': ['synthesize', 'create', 'design', 'generate', 'compose'],
'evaluation': ['evaluate', 'judge', 'assess', 'critique', 'justify']
for level, keywords in [Link]():
for keyword in keywords:
if keyword in [Link]():
return level
return 'knowledge'
def rewrite_questions(input_file, output_file):
try:
with open(input_file, 'r') as f:
questions = [Link]()
with open(output_file, 'w') as f:
for question in questions:
blooms_level = determine_blooms_level(question)
rewritten_question = f"{[Link]()} [{blooms_level.capitalize()}]\n"
[Link](rewritten_question)
print("Questions rewritten with Bloom's level and written to file successfully.")
except FileNotFoundError:
print("Input file not found.")
except Exception as e:
print(f"An error occurred: {str(e)}")
input_file = 'input_questions.txt'
output_file = 'output_questions.txt'
rewrite_questions(input_file, output_file)
output:
Input file not found.
=== Code Execution Successful ===