# Generate a PDF with 100 words, each having 5 synonyms and 5 antonyms
from fpdf import FPDF
# Extend the list to include 100 words with synonyms and antonyms
expanded_data = []
base_data = [
{
“word”: “Happy”,
“synonyms”: [“Joyful”, “Cheerful”, “Content”, “Blissful”, “Elated”],
“antonyms”: [“Sad”, “Unhappy”, “Miserable”, “Depressed”, “Gloomy”]
},
{
“word”: “Brave”,
“synonyms”: [“Courageous”, “Bold”, “Daring”, “Fearless”, “Heroic”],
“antonyms”: [“Cowardly”, “Fearful”, “Timid”, “Nervous”, “Weak”]
},
{
“word”: “Strong”,
“synonyms”: [“Powerful”, “Sturdy”, “Mighty”, “Robust”, “Tough”],
“antonyms”: [“Weak”, “Fragile”, “Delicate”, “Frail”, “Feeble”]
},
{
“word”: “Fast”,
“synonyms”: [“Quick”, “Speedy”, “Swift”, “Rapid”, “Brisk”],
“antonyms”: [“Slow”, “Sluggish”, “Lethargic”, “Unhurried”, “Delayed”]
},
{
“word”: “Beautiful”,
“synonyms”: [“Attractive”, “Pretty”, “Gorgeous”, “Lovely”, “Stunning”],
“antonyms”: [“Ugly”, “Unattractive”, “Plain”, “Unappealing”, “Hideous”]
},
{
“word”: “Smart”,
“synonyms”: [“Intelligent”, “Bright”, “Clever”, “Sharp”, “Wise”],
“antonyms”: [“Dumb”, “Foolish”, “Stupid”, “Ignorant”, “Unwise”]
},
{
“word”: “Kind”,
“synonyms”: [“Compassionate”, “Generous”, “Benevolent”, “Gentle”, “Caring”],
“antonyms”: [“Cruel”, “Mean”, “Harsh”, “Selfish”, “Unkind”]
},
{
“word”: “Calm”,
“synonyms”: [“Peaceful”, “Tranquil”, “Serene”, “Quiet”, “Relaxed”],
“antonyms”: [“Agitated”, “Anxious”, “Tense”, “Restless”, “Irritated”]
},
{
“word”: “Bright”,
“synonyms”: [“Shining”, “Radiant”, “Vivid”, “Luminous”, “Brilliant”],
“antonyms”: [“Dim”, “Dull”, “Dark”, “Gloomy”, “Shadowy”]
},
{
“word”: “Friendly”,
“synonyms”: [“Amiable”, “Affable”, “Cordial”, “Approachable”, “Sociable”],
“antonyms”: [“Hostile”, “Unfriendly”, “Cold”, “Aloof”, “Rude”]
}
]
# Repeat the base data to generate 100 entries
for i in range(10): # Base data has 10 entries, repeating it 10 times
for entry in base_data:
expanded_data.append(entry)
if len(expanded_data) == 100: # Stop once we reach 100 entries
break
# Create a PDF instance
pdf = FPDF()
pdf.set_auto_page_break(auto=True, margin=15)
pdf.add_page()
pdf.set_font(“Arial”, size=12)
# Add content to the PDF
for idx, entry in enumerate(expanded_data, start=1):
pdf.set_font(“Arial”, style=’B’, size=12)
pdf.cell(0, 10, f”{idx}. Word: {entry[‘word’]}”, ln=True)
pdf.set_font(“Arial”, size=12)
pdf.cell(0, 10, “Synonyms: ” + “, “.join(entry[‘synonyms’]), ln=True)
pdf.cell(0, 10, “Antonyms: ” + “, “.join(entry[‘antonyms’]), ln=True)
pdf.ln(5)
# Save the PDF
file_path_100 = “/mnt/data/100_Words_Synonyms_Antonyms.pdf”
pdf.output(file_path_100)
file_path_100
Facebook
Twitter
LinkedIn
Email
WhatsApp