Build an AI-Powered ELVi Practice Tool
Generate ELVi LVA exam exercises from live BBC and Guardian news with Gemini AI.
Introduction
30 Second Summary
Preparing for the ELVi English exam means practicing with real press articles every single day. Finding fresh material and turning it into proper practice exercises takes real effort.
In this project, you will build a Python notebook that pulls live news headlines from BBC News and The Guardian, then uses Google's Gemini AI to generate a complete set of ELVi LVA practice exercises from any article.
What You'll Build
Every time you open your notebook and click "Run All," it fetches today's headlines, picks an article, and generates exam-format exercises ready for you to practice with.
By the end of this project, you'll have:
- A Google Colab notebook that pulls the latest real headlines from BBC News and The Guardian using RSS feeds, so you can pick any topic that interests you.
- AI-generated ELVi exercises from the article you choose: an analytical summary prompt (350 words), an argumentative essay question (500 words), key vocabulary with definitions, and a French-to-English translation passage (200 words).
- A one-click daily study tool that produces fresh material every run, so you never practice with the same content twice.
- Secret Mission: Add an AI-powered self-grading system where Gemini evaluates your written responses against ELVi CECR-aligned criteria with detailed feedback.
Are there any prerequisites?
All you need is a Google account (Gmail). No coding experience is required. Everything runs for free in your browser using Google Colab.
Before We Start
Before we dive in, let's lock in what you're about to build and why it matters for your ELVi exam prep.
Set Up Google Colab and Your Gemini API Key
Before you can build anything, you need two things: a place to run Python code, and access to AI.
Google Colab gives you a free Python notebook that runs entirely in your browser. The Gemini API gives your notebook the power to generate text with AI. In this step, you'll set up both and confirm they can talk to each other.
In this step, get ready to:
- Open Google Colab and create a new notebook.
- Get a free Gemini API key and store it securely.
- Install the Google GenAI SDK and test the connection.
Open Google Colab and create a new notebook
Google Colab is a free online notebook where you can write and run Python code without installing anything on your computer.
- Open a new browser tab and go to colab.research.google.com.
- Sign in with your Google account if prompted.
- Click New notebook to create a blank notebook.
A new notebook opens with one empty code cell, ready for you to type Python code.
- Click the notebook title at the top left (it says Untitled0.ipynb by default).
- Replace the title with ELVi English Practice Tool and press Enter.
Your browser tab now shows ELVi English Practice Tool as the notebook name.
Don't see New notebook?
A welcome dialog may appear instead. Close it and look for File in the top menu bar, then select New notebook.
Help me create a new notebook in Google Colab.
Get your free Gemini API key
An API key is a unique code that lets your notebook send requests to Gemini. Think of it as a password that proves your notebook has permission to use the AI.
- Open a new browser tab and go to aistudio.google.com.
- Sign in with your Google account.
Do I need to create a project?
No. Google AI Studio automatically creates a default project and API key for new users after you accept the Terms of Service. You do not need to set anything up manually.
- Click Get API key in the left sidebar.
- Copy the API key shown on the API keys page.
No key listed?
If no key appears on the page, click Create API key, select the default project in the dialog, and copy the key it generates.
Now you need to store the key inside your Colab notebook so your code can use it without exposing it.
- Switch back to your Google Colab notebook tab.
- Click the key icon in the left sidebar to open Secrets.
- Click Add new secret.
- In the Name field, type GEMINI_API_KEY.
- Paste your API key in the Value field.
- Toggle Notebook access to on.
Your secret now appears in the Secrets panel with the toggle switched on. The value is hidden, so your key stays safe.
Why use Secrets instead of pasting the key in my code?
Pasting an API key directly in a code cell means anyone who sees your notebook can steal it. Colab Secrets stores the key separately and injects it at runtime, so the key never appears in your code.
Don't see the key icon?
The left sidebar may be collapsed. Look for a small arrow or hamburger menu at the top left of the Colab window and click it to expand the sidebar. The key icon appears below the file and search icons.
Help me find Colab Secrets to store my API key.
Install the Google GenAI SDK and test the connection
Your notebook needs the Google GenAI SDK to communicate with Gemini. You'll install it along with feedparser (a library you'll use in the next step to read news articles).
- Click the empty code cell in your notebook.
- Add the install command and import statements by pasting this code into the cell:
# Install required packages
!pip install -q google-genai feedparser
# Import libraries
from google import genai
from google.genai import types
import feedparser
import random
from datetime import datetime
from google.colab import userdata
What does this code do?
The ! at the start of !pip install tells Colab to run a terminal command. The -q flag keeps the output quiet so you only see errors, not progress bars.
The import lines load the libraries your notebook will use: genai for Gemini, feedparser for reading RSS news feeds, and userdata to read the API key from Colab Secrets.
- Below the imports in the same cell, add the Gemini client setup and test by pasting this code:
# Set up Gemini client
GEMINI_API_KEY = userdata.get('GEMINI_API_KEY')
client = genai.Client(api_key=GEMINI_API_KEY)
# Test the connection
response = client.models.generate_content(
model='gemini-3.5-flash',
contents='Say hello in English and French in one sentence.'
)
print("Gemini is connected!")
print(response.text)
What does this code do?
The userdata.get('GEMINI_API_KEY') line pulls your API key from Colab Secrets. It then creates a client object that handles all communication with Gemini.
The generate_content call sends a simple prompt to the gemini-3.5-flash model and stores whatever Gemini writes back in response.
Before you run this, what do you think you'll see in the output? Will it succeed or fail?
- Click the play button to the left of the cell (or press Shift+Enter) to run it.
You should see Gemini is connected! followed by Gemini's response in English and French.
Seeing an error instead?
- If you see a message about an invalid API key, open Secrets in the left sidebar and check that the name is exactly GEMINI_API_KEY with no extra spaces. Also confirm Notebook access is toggled on.
- If you see a module not found error for google.genai, make sure the !pip install -q google-genai feedparser line is at the top of your cell and you ran the entire cell (not just part of it).
Help me fix my Gemini API connection in Google Colab.
✔️ Awesome, I've got everything!
Double check you've saved your notebook. Colab auto-saves to Google Drive, but you can press Cmd+S (macOS) or Ctrl+S (Windows) to be sure.
ⓧ I'd like to double check the full code
Here is the complete code for Cell 1. Compare it to what you have in your notebook:
# Install required packages
!pip install -q google-genai feedparser
# Import libraries
from google import genai
from google.genai import types
import feedparser
import random
from datetime import datetime
from google.colab import userdata
# Set up Gemini client
GEMINI_API_KEY = userdata.get('GEMINI_API_KEY')
client = genai.Client(api_key=GEMINI_API_KEY)
# Test the connection
response = client.models.generate_content(
model='gemini-3.5-flash',
contents='Say hello in English and French in one sentence.'
)
print("Gemini is connected!")
print(response.text)
Your notebook is alive and talking to Gemini. Next up, you'll teach it to fetch real news articles from US and UK newspapers.
Fetch Live News from US and UK Newspapers
Your notebook is connected to Gemini and ready to generate text. But right now it has no news content to work with.
The ELVi exam tests your ability to analyse real-world press articles. To get authentic, current material, you will pull live headlines from BBC News and The Guardian using RSS feeds. By the end of this step, your notebook will fetch today's news every time you run it.
In this step, get ready to:
- Pull BBC News headlines using RSS feeds.
- Add The Guardian as a second source for UK press coverage.
- Display a numbered list of articles ready for practice.
Pull BBC News headlines using RSS feeds
An RSS feed is a structured data stream that websites publish so programs can read their latest content automatically. News sites like BBC and The Guardian keep their RSS feeds free and public, which means your notebook can grab today's headlines without any sign-up or API key.
What is an RSS feed?
Think of an RSS feed as a live bulletin board. Every time a newspaper publishes a new article, the feed updates with the headline, a short summary, and a link.
Your code reads that bulletin board with feedparser, the library you installed in the previous step. It turns the raw feed data into Python dictionaries you can loop through.
- Click the + Code button at the top of your notebook to create a new code cell below Cell 1.
- Set up the BBC News RSS feed URLs and a function to fetch articles by pasting this code into the new cell:
# RSS feed URLs for US and UK press
feeds = {
'BBC World News': 'http://feeds.bbci.co.uk/news/world/rss.xml',
'BBC US & Canada': 'http://feeds.bbci.co.uk/news/world/us_and_canada/rss.xml',
}
def fetch_news(feeds):
"""Fetch articles from all RSS feeds."""
all_articles = []
for source_name, feed_url in feeds.items():
feed = feedparser.parse(feed_url)
for entry in feed.entries[:5]:
all_articles.append({
'source': source_name,
'title': entry.get('title', 'No title'),
'summary': entry.get('summary', 'No summary available'),
'link': entry.get('link', ''),
})
return all_articles
What does this code do?
- The feeds dictionary maps a human-readable source name to its RSS feed URL. You start with two BBC feeds: World News and US & Canada.
- The fetch_news() function loops through every feed, parses it with feedparser, and grabs the 5 most recent articles from each one.
- Each article is stored as a dictionary with four keys: source, title, summary, and link. The summary is what Gemini will use to generate exercises later.
- Still in the same cell, add this code below the function to call it and display the results:
# Fetch and display articles
articles = fetch_news(feeds)
print(f"Fetched {len(articles)} articles from US and UK press\n")
print("=" * 60)
for i, article in enumerate(articles):
print(f"\n[{i + 1}] ({article['source']})")
print(f" {article['title']}")
print("\n" + "=" * 60)
What does this code do?
- articles = fetch_news(feeds) runs the function you just wrote and stores all fetched articles in a list.
- The for loop prints each article as a numbered entry with its source label and title. This gives you a menu of articles to choose from.
Before you run this cell, what do you think the output will look like? How many articles do you expect to see?
- Click the play button on the left side of Cell 2 to run it.
You should see a numbered list of 10 articles (5 from each BBC feed) with real headlines from today's news.
Not seeing any headlines?
- Make sure you ran Cell 1 first. Cell 2 depends on the feedparser import from Cell 1.
- Check that both code blocks are in the same cell, not in two separate cells. The display code needs access to the feeds dictionary and fetch_news() function defined above it.
- If you see 0 articles, your network may be blocking the RSS feeds. Try running the cell again after a few seconds.
Help me debug why my RSS feed cell is not printing any headlines.
Add The Guardian as a second source for UK press
The ELVi exam expects you to compare perspectives from different publications. Adding The Guardian gives you a second UK source alongside the BBC.
- In Cell 2, find the feeds dictionary at the top. It currently looks like this:
feeds = {
'BBC World News': 'http://feeds.bbci.co.uk/news/world/rss.xml',
'BBC US & Canada': 'http://feeds.bbci.co.uk/news/world/us_and_canada/rss.xml',
}
- Add two Guardian feeds after the BBC entries, so the dictionary now looks like this:
feeds = {
'BBC World News': 'http://feeds.bbci.co.uk/news/world/rss.xml',
'BBC US & Canada': 'http://feeds.bbci.co.uk/news/world/us_and_canada/rss.xml',
'The Guardian World': 'https://www.theguardian.com/world/rss',
'The Guardian UK': 'https://www.theguardian.com/uk/rss',
}
How do Guardian RSS feeds work?
The Guardian makes it simple. You take any section URL on their site and add /rss to the end. For example, theguardian.com/world becomes theguardian.com/world/rss. You could swap in any section you want to practice with, like /business/rss or /technology/rss.
- Run Cell 2 again by clicking the play button.
You should now see around 20 articles in the list. The source labels show a mix of BBC and Guardian entries.
Still seeing only 10 articles?
- Make sure you added the Guardian entries inside the curly braces of the existing feeds dictionary, not below it as a separate variable.
- Check that each entry ends with a comma, including the second BBC entry. A missing comma between entries causes a syntax error.
Help me fix my feeds dictionary after adding Guardian entries.
Review your article list
Each numbered entry in your output is an article stored in the articles list. Behind the scenes, every article holds four pieces of data: the source name, the headline title, a summary of the article, and a link to the full piece.
The summary is the key ingredient. In the next step, you will feed it to Gemini so the AI can generate practice exercises based on real news content.
✔️ Awesome, I've got everything!
Great. Double check you see headlines from both BBC and Guardian sources in your output, then move on.
ⓧ I'd like to double check the full code
Here is the complete Cell 2 code. Make sure yours matches exactly:
# RSS feed URLs for US and UK press
feeds = {
'BBC World News': 'http://feeds.bbci.co.uk/news/world/rss.xml',
'BBC US & Canada': 'http://feeds.bbci.co.uk/news/world/us_and_canada/rss.xml',
'The Guardian World': 'https://www.theguardian.com/world/rss',
'The Guardian UK': 'https://www.theguardian.com/uk/rss',
}
def fetch_news(feeds):
"""Fetch articles from all RSS feeds."""
all_articles = []
for source_name, feed_url in feeds.items():
feed = feedparser.parse(feed_url)
for entry in feed.entries[:5]:
all_articles.append({
'source': source_name,
'title': entry.get('title', 'No title'),
'summary': entry.get('summary', 'No summary available'),
'link': entry.get('link', ''),
})
return all_articles
# Fetch and display articles
articles = fetch_news(feeds)
print(f"Fetched {len(articles)} articles from US and UK press\n")
print("=" * 60)
for i, article in enumerate(articles):
print(f"\n[{i + 1}] ({article['source']})")
print(f" {article['title']}")
print("\n" + "=" * 60)
Your notebook now pulls real headlines from four different news feeds every time you run it. Next up, you will send one of these articles to Gemini and have it generate a full set of ELVi practice exercises.
Generate ELVi Practice Exercises with AI
Your notebook can now pull real headlines from BBC News and The Guardian. That is authentic press material, exactly the kind of source you would face on exam day.
The problem is that a raw headline does not help you practice writing summaries, essays, or translations. You need something that transforms a news article into a structured set of exercises matching the official ELVi LVA format. That is exactly what Gemini will do in this step.
In this step, get ready to:
- Craft a detailed prompt that instructs Gemini to generate ELVi-format exercises.
- Send a news article to Gemini and receive a complete practice set with summaries, essays, vocabulary, and translation.
Craft the ELVi-specific prompt
Prompt engineering is the art of giving AI clear, specific instructions so it produces exactly the output you need. A vague prompt like "make me some English exercises" would give you generic results that do not match the ELVi format.
What is the ELVi LVA exam format?
The ELVi LVA (Concours BCE) is a 4-hour English exam with three weighted components. The analytical comparative summary (résumé analytique comparatif) is 350 words and worth 30% of your grade. The argumentative essay (essai argumenté) is 500 words and worth 50%. The French-to-English translation (thème) is 200 words and worth 20%.
Before writing the prompt, you need to pick which article Gemini will work with. Your articles list from Cell 2 holds all the fetched headlines. You will use random.choice() to pick one at random.
- Click the + Code button below Cell 2 to create a new code cell.
- Select a random article and display it by pasting this code into the new cell:
# Select a random article for daily practice
selected = random.choice(articles)
print(f"Selected article: {selected['title']}")
print(f"Source: {selected['source']}")
print(f"Date: {datetime.now().strftime('%A %d %B %Y')}\n")
What does this code do?
- random.choice(articles) picks one article at random from your full list of BBC and Guardian headlines.
- The three print lines display the article title, which news source it came from, and today's date so you can track your practice.
- Run the cell by pressing Shift+Enter.
You should see one article title, its news source, and today's date printed in the output.
Seeing a NameError?
- If you see NameError: name 'articles' is not defined, go back and run Cell 2 first. Cell 3 depends on the articles list that Cell 2 creates.
- If you see NameError: name 'random' is not defined, go back and run Cell 1 first. The random library is imported there.
Help me fix a NameError in my Google Colab notebook
Now you know which article Gemini will use. The next piece is the prompt itself. This prompt needs to instruct Gemini to produce all four sections of the ELVi exam format, with the correct word counts and structure.
- Add the first part of the ELVi prompt directly below the code you already have in Cell 3:
# Build the ELVi-specific prompt
elvi_prompt = f"""You are an English language exam coach specializing in the French ELVi LVA exam
(Concours BCE). Based on the news article below, generate a complete set of
practice exercises matching the official ELVi LVA format.
NEWS ARTICLE:
Title: {selected['title']}
Source: {selected['source']}
Summary: {selected['summary']}
Generate the following exercises:
1. COMPARATIVE SUMMARY TASK (Résumé analytique comparatif)
Create a dossier-style exercise with two contrasting perspectives on the topic
from the article. Write two short source texts (150-200 words each) presenting
different viewpoints. Then give the student this instruction:
"Write an analytical comparative summary of these two texts in 350 words (+/- 10%)."
What is happening in this prompt so far?
- The opening line assigns Gemini a specific role: an ELVi exam coach. This focuses the AI on producing exam-format output instead of generic exercises.
- The NEWS ARTICLE section injects the selected article's title, source, and summary using f-string variables. This is how the prompt uses real news content.
- Exercise 1 asks for a comparative summary task with two contrasting source texts, matching the 350-word résumé analytique comparatif format worth 30% of the exam grade.
- Add the remaining three exercise sections and close the prompt by pasting this code directly below what you just added, still in the same cell:
2. ARGUMENTATIVE ESSAY QUESTION (Essai argumenté)
Write a thought-provoking essay question related to the article's theme.
The student must write a personal argumentative essay of 500 words (+/- 10%).
Include 3 bullet points suggesting possible angles to explore.
3. KEY VOCABULARY (10 items)
List 10 advanced English vocabulary words from the topic area.
For each word, provide: the word, its part of speech, a clear English definition,
and an example sentence using the word in context.
4. FRENCH-TO-ENGLISH TRANSLATION EXERCISE (Thème)
Write a short passage in French (200 words +/- 10%) related to the article's
theme. The passage should use formal register appropriate for the ELVi exam
and test key grammar points (subjunctive, conditionals, relative clauses).
Format everything clearly with section headings and line breaks."""
What do the remaining exercises cover?
- Exercise 2 asks for an argumentative essay question (500 words), which is worth 50% of the exam. The three bullet-point angles help you brainstorm before writing.
- Exercise 3 generates 10 advanced vocabulary items with definitions and example sentences, building the academic register the exam expects.
- Exercise 4 creates a French passage for translation into English (thème), targeting tricky grammar like subjunctive, conditionals, and relative clauses.
Send the prompt to Gemini and display the exercises
The prompt is ready. Now you need to send it to Gemini and print the response. You will also configure two settings that control how the AI generates its output.
- Add the API call and display code at the bottom of Cell 3 by pasting this below your prompt:
# Send to Gemini
response = client.models.generate_content(
model='gemini-3.5-flash',
contents=elvi_prompt,
config=types.GenerateContentConfig(
temperature=0.7,
max_output_tokens=4000,
),
)
# Display the exercises
print("=" * 60)
print(f" ELVi LVA Practice Exercises - {datetime.now().strftime('%d/%m/%Y')}")
print("=" * 60)
print(response.text)
What do temperature and max_output_tokens do?
- temperature=0.7 controls how creative the AI is. A value of 0.7 gives varied, natural-sounding exercises each time. Lower values (like 0.2) would make the output more predictable and repetitive.
- max_output_tokens=4000 sets the maximum length of the response. The exercises include two source texts, an essay question, 10 vocabulary items, and a translation passage, so they need room to be thorough.
Before you run the cell, what do you think the output will look like? Will it be a short paragraph or something longer and more structured?
- Run the full cell by pressing Shift+Enter.
You should see the selected article info at the top, followed by a complete ELVi exercise set. Look for all four sections: a Comparative Summary Task with two contrasting source texts, an Argumentative Essay Question with suggested angles, a Key Vocabulary list of 10 items, and a French-to-English Translation Exercise.
Why does the output look different every time?
The temperature=0.7 setting means Gemini introduces variation each run. Combined with the random article selection, you get a unique practice set every single time. No two sessions will be the same.
Seeing an error or empty output?
- If you see a SyntaxError, check that the triple quotes """ open and close the f-string correctly. The prompt starts with f""" and must end with """ on its own.
- If you see NameError: name 'client' is not defined, run Cell 1 again to re-create the Gemini client.
- If the exercises seem cut off, the response may have hit the token limit. Try running the cell again. Gemini generates a fresh response each time.
Help me debug my Gemini API call in Google Colab
✔️ Awesome, I've got everything!
Great. Double check that your Cell 3 includes all three sections: article selection at the top, the full elvi_prompt string in the middle, and the API call with display at the bottom.
ⓧ I'd like to double check the full code
Scroll up through your Cell 3 and confirm these three sections appear in order:
- Article selection: starts with selected = random.choice(articles) and three print statements.
- ELVi prompt: starts with elvi_prompt = f""" and includes all four numbered exercises (COMPARATIVE SUMMARY TASK, ARGUMENTATIVE ESSAY QUESTION, KEY VOCABULARY, FRENCH-TO-ENGLISH TRANSLATION EXERCISE). Ends with """ closing the string.
- API call and display: starts with response = client.models.generate_content( and ends with print(response.text).
You just turned a raw news headline into a full ELVi practice session. Next up, you will make this notebook a one-click daily tool that automatically picks articles and formats the exercises for study use.
Make It a One-Click Daily Tool
In the last step, you turned a raw news article into a full set of ELVi LVA practice exercises. Your notebook already picks a random article each time Cell 3 runs, so the content is fresh every session.
One thing is still missing: convenience. If you want a second round of exercises, you have to rerun the entire notebook from scratch. In this step, you will verify that the notebook works as a true one-click tool, then add a button that generates new exercises instantly.
In this step, get ready to:
- Test the one-click flow by running all cells at once.
- Add a "Generate New Exercises" button for quick practice rounds.
Test the one-click flow
A daily study tool should work with a single action. Because Cell 3 already selects a random article and formats the output with a date stamp, your notebook is ready to run end-to-end without any manual input.
Before you run it, what do you think will happen when all four cells execute in order? Will every cell succeed, or will something break?
- In the Colab menu bar, click Runtime.
- Click Run all.
All three cells execute in sequence. Cell 1 installs the packages and connects to Gemini. Cell 2 fetches live headlines. Cell 3 picks a random article and generates a complete ELVi exercise set with today's date.
What makes this one-click?
Cell 3 uses random.choice(articles) to automatically pick an article from the combined BBC and Guardian feeds. There is no manual selection step. Every time you run all cells, you get a different article and a fresh set of exercises.
The output already includes the date, the source name, and clear section headings (Summary Task, Essay Question, Vocabulary, Translation Exercise) with word count targets matching the ELVi format.
Cells didn't all run?
- If Cell 1 fails, your GEMINI_API_KEY secret may have notebook access toggled off. Click the key icon in the left sidebar and check the toggle is on.
- If Cell 2 shows zero articles, your network may be blocking RSS feeds. Try running the cell again.
Still stuck? Help me debug why Runtime > Run All isn't completing all cells in my Colab notebook.
Create the "Run Again" button
The one-click flow works, but getting a second exercise set means rerunning the entire notebook. A button that generates new exercises from a different article saves time and keeps you in the flow.
- Click the + Code button at the top of the notebook to add a new code cell below Cell 3.
- Start the cell by importing the widget libraries and defining the function that runs when the button is clicked:
import ipywidgets as widgets
from IPython.display import display, clear_output
def generate_new_exercises(button):
"""Generate exercises from a different random article."""
clear_output(wait=True)
display(button)
new_article = random.choice(articles)
print(f"\nNew article: {new_article['title']}")
print(f"Source: {new_article['source']}")
print(f"Date: {datetime.now().strftime('%A %d %B %Y')}\n")
What does this code do?
- ipywidgets provides interactive UI elements like buttons inside Colab notebooks. It comes pre-installed in Google Colab.
- clear_output(wait=True) wipes the previous exercises from the screen before displaying new ones, keeping the output clean.
- display(button) re-renders the button after clearing, so you can click it again for another round.
- random.choice(articles) picks a new random article from the feeds that Cell 2 already fetched.
- Directly below the code you just typed (still inside the same cell), add the ELVi prompt. This is the same prompt from Cell 3, updated to use new_article instead of selected:
new_prompt = f"""You are an English language exam coach specializing in the French ELVi LVA exam
(Concours BCE). Based on the news article below, generate a complete set of
practice exercises matching the official ELVi LVA format.
NEWS ARTICLE:
Title: {new_article['title']}
Source: {new_article['source']}
Summary: {new_article['summary']}
Generate the following exercises:
1. COMPARATIVE SUMMARY TASK (Résumé analytique comparatif)
Create a dossier-style exercise with two contrasting perspectives on the topic
from the article. Write two short source texts (150-200 words each) presenting
different viewpoints. Then give the student this instruction:
"Write an analytical comparative summary of these two texts in 350 words (+/- 10%)."
2. ARGUMENTATIVE ESSAY QUESTION (Essai argumenté)
Write a thought-provoking essay question related to the article's theme.
The student must write a personal argumentative essay of 500 words (+/- 10%).
Include 3 bullet points suggesting possible angles to explore.
3. KEY VOCABULARY (10 items)
List 10 advanced English vocabulary words from the topic area.
For each word, provide: the word, its part of speech, a clear English definition,
and an example sentence using the word in context.
4. FRENCH-TO-ENGLISH TRANSLATION EXERCISE (Thème)
Write a short passage in French (200 words +/- 10%) related to the article's
theme. The passage should use formal register appropriate for the ELVi exam
and test key grammar points (subjunctive, conditionals, relative clauses).
Format everything clearly with section headings and line breaks."""
Reusing your prompt
This prompt is identical to the one in Cell 3. The only difference is the variable name: new_article instead of selected. You can copy the prompt from Cell 3 and change those three references to save time.
- Complete the function and create the button by adding this final section to the same cell:
new_response = client.models.generate_content(
model='gemini-3.5-flash',
contents=new_prompt,
config=types.GenerateContentConfig(
temperature=0.7,
max_output_tokens=4000,
),
)
print("=" * 60)
print(f" ELVi LVA Practice Exercises - {datetime.now().strftime('%d/%m/%Y')}")
print("=" * 60)
print(new_response.text)
button = widgets.Button(
description='Generate New Exercises',
button_style='success',
layout=widgets.Layout(width='250px', height='40px')
)
button.on_click(generate_new_exercises)
display(button)
What does this code do?
- The function sends the new prompt to gemini-3.5-flash with the same settings as Cell 3 (temperature=0.7, max_output_tokens=4000), then prints the formatted exercises.
- The last four lines sit outside the function. They create a green button labelled "Generate New Exercises", connect it to the generate_new_exercises function, and display it in the cell output.
- Run Cell 4 by clicking the play button on its left side.
A green Generate New Exercises button appears in the cell output.
- Click the Generate New Exercises button.
The previous output clears, the button reappears, and a brand new ELVi exercise set prints below it based on a different article. You can click the button as many times as you like for additional rounds.
Button doesn't appear or nothing happens when you click?
- Make sure the last four lines (button = widgets.Button(...) through display(button)) are NOT indented. They must sit at the left margin, outside the function definition.
- If clicking the button produces no output, check that Cell 2 ran successfully first. The button function relies on the articles list from Cell 2.
- Check that on_click references generate_new_exercises (no parentheses). Adding () would call the function immediately instead of connecting it to the button.
Still stuck? Help me debug why my ipywidgets button isn't working in Google Colab.
✔️ Awesome, I've got everything!
Great. Double check you have all three parts in Cell 4: the imports and function start (part 1), the prompt string (part 2), and the API call plus button setup (part 3). Make sure the cell is saved.
ⓧ I'd like to double check the full code
Cell 4 is built from three sections you added above. Scroll up and confirm each is present in order:
- Part 1: The import ipywidgets lines, followed by the def generate_new_exercises(button): function header through the three print statements.
- Part 2: The new_prompt f-string containing the full ELVi prompt with new_article variables.
- Part 3: The client.models.generate_content() call, the formatted print block, and the four un-indented lines that create and display the button.
Run the full notebook end-to-end
Time for the final test. What do you expect to see when all four cells run in sequence?
- Click Runtime in the menu bar, then click Run all.
All four cells execute automatically. Cell 1 connects to Gemini. Cell 2 fetches headlines. Cell 3 generates a full ELVi exercise set from a random article. Cell 4 displays the green Generate New Exercises button, ready for you to click for another round.
Your ELVi practice tool is complete. You have a free, reusable notebook that generates fresh exam-format exercises from real US and UK press articles every day. Next up, see if you can take it even further with a Secret Mission.
Secret mission
Add AI-Powered Self-Grading
Your notebook generates great practice exercises, but right now you have no way to check your own work. In this bonus challenge, you will add a self-grading cell where Gemini evaluates your written responses against the official ELVi CECR-aligned criteria and gives you detailed, criterion-by-criterion feedback.
Clean Up Your Resources
Clean Up Your Resources
This project runs entirely in Google Colab using the Gemini API free tier, so there are no ongoing costs. Decide whether to keep your resources for future practice sessions or delete them entirely.
Resources you used:
- Google Colab notebook (ELVi English Practice Tool) stored in Google Drive.
- Gemini API key stored in Google AI Studio and Colab Secrets (GEMINI_API_KEY).
Keep everything running
No action needed. Choose this if you plan to keep practicing with your ELVi tool.
- Your notebook stays in Google Drive and is accessible anytime at colab.research.google.com.
- The Gemini API free tier has no charges, so your API key costs nothing to keep.
- Packages installed with !pip install are cleared automatically when the Colab runtime disconnects. They reinstall each time you run Cell 1.
Pause - I'll come back to this later
Google Colab handles pausing for you. There is nothing to shut down manually.
- Colab automatically disconnects your runtime after a period of inactivity. Any installed packages are cleared at that point.
- Your notebook file remains saved in Google Drive, ready to reopen whenever you want to practice again.
- Your GEMINI_API_KEY secret stays stored in Colab Secrets for next time.
Delete - I don't want to use this again
Remove your notebook, API key, and stored secret so nothing remains from this project.
- Delete the Colab notebook: open drive.google.com, find the ELVi English Practice Tool notebook, right-click it, and select Move to trash.
- Remove the Colab Secret: open any notebook at colab.research.google.com, click the key icon in the left sidebar to open Secrets, find GEMINI_API_KEY, and delete it.
- Revoke the API key: go to aistudio.google.com, open the API keys page, find the key you created for this project, and delete it.
Nice Work!
Nice Work!
Nice work! You just built your own AI-powered English exam coach that generates fresh ELVi LVA practice exercises from real news articles every single day.
You've learned how to:
- Built a Python notebook in Google Colab that fetches live news from BBC News and The Guardian using RSS feeds.
- Connected to Google's Gemini AI using the free tier API to generate ELVi LVA practice exercises tailored to real press articles.
- Created a one-click daily study tool that produces analytical summary prompts (350 words), argumentative essay questions (500 words), vocabulary lists, and French-to-English translation exercises (200 words).
- Secret Mission: Added an AI-powered self-grading system that evaluates your written responses against ELVi CECR-aligned criteria with detailed feedback and improvement priorities.
Ready to quiz yourself?