0% found this document useful (0 votes)
22 views4 pages

News Article Summarization Prompts

The document contains two main parts: a prompt engineering assignment focused on summarizing a news article about renewable energy and a Python assignment for creating a basic calculator. The prompt engineering section includes various prompts and responses that summarize the growth of renewable energy investments and their implications. The Python assignment outlines a calculator program with basic operations, error handling, and a bonus power function.

Uploaded by

perarasu718
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)
22 views4 pages

News Article Summarization Prompts

The document contains two main parts: a prompt engineering assignment focused on summarizing a news article about renewable energy and a Python assignment for creating a basic calculator. The prompt engineering section includes various prompts and responses that summarize the growth of renewable energy investments and their implications. The Python assignment outlines a calculator program with basic operations, error handling, and a bonus power function.

Uploaded by

perarasu718
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

Part 1: Prompt Engineering Assignment

Task chosen: Summarizing a news article

Three prompts & AI Responses


1. Concise Prompt (Short & Direct)
Prompt: “Summarize the following news article in 2 sentences: Renewable energy”.
Response: The article highlights the recent rise in renewable energy investments worldwide.
Experts predict that solar and wind energy will dominate the energy market within the next
decade.

[Link] Prompt (Casual & Clear)


Prompt: “Read this news article and give me a short summary in simple language, focusing
on the key events and outcomes: Renewable energy”.
Response: The article reports that renewable energy is growing quickly, with more countries
switching from fossil fuels to clean power. Governments and investors believe this shift will
lower costs, create jobs, and help reduce climate change.

3. Detailed Prompt (Structured & Formal)


Prompt: “Summarize the following article in detail. Highlight the main topic, supporting
evidence, and the implications for the future. Make sure the summary is clear and well-
structured: Renewable energy”.
Response: The article discusses the rapid global expansion of renewable energy, particularly
in solar and wind sectors. It provides evidence of increased government investments,
corporate initiatives, and international collaboration aimed at reducing carbon emissions.
The piece concludes that this transition will not only reshape the energy sector but also have
wide-ranging economic and environmental benefits over the coming decade.

Bonus Prompt (Challenging & Creative)


Prompt: “Generate a mystery story set in a small town where everyone hides a secret.
Include a shocking plot twist at the end.”
Response: A detective arrives in a quiet village where each resident avoids his questions. As
secrets unfold, he discovers that the townspeople are hiding the truth about a murder. The
shocking twist: the detective himself is the victim, and the town has been reliving the same
day to cover it up.
Part 2: Python Assignment – Basic Calculator
#Basic Calculator with Error Handling
def add(a, b):
return a + b
def subtract(a, b):
return a – b
def multiply(a, b):
return a * b
def divide(a, b):
try:
return a / b
except ZeroDivisionError:
return “Error: Division by zero is not allowed.”
def power(a, b):
Return a ** b #Bonus feature
Def calculator():
While True:
print(“\n---Basic Calculator—")
print(“Select operation:”)
print(“1. Addition (+)”)
print(“2. Subtraction (-)”)
print(“3. Multiplication (*)”)
print(“4. Division (/)”)
print(“5. Power (^)”)
print(“6. Exit”)
choice = input(“Enter choice (1-6): “)
if choice == ‘6’:
print(“Exiting [Link]!”)
break
try:
num1 = float(input(“Enter first number: “))
num2 = float(input(“Enter second number:”))
except ValueError:
print(“Invalid input! Please enter numbers only.”)
continue
if choice == ‘1’:
print(“Result:”, add(num1, num2))
elif choice == ‘2’:
print(“Result:”, subtract(num1, num2))
elif choice == ‘3’:
print(“Result:”, multiply(num1, num2))
elif choice == ‘4’:
print(“Result:”, divide(num1, num2))
elif choice == ‘5’:
print(“Result:”, power(num1, num2))
else:
print(“Invalid choice! Please try again.”)
#Run the calculator
Calculator()

Features:
. Addition, subtraction, Multiplication, Division
. Division by zero handling
. Invalid input handling
. Menu-driven program with loop
. Bonus: Power function (^)

You might also like