wk03.p8Practice exerciseWeek 03 · Data and the outside worldOpen · due this week

Trust, but verify

An AI will happily explain any function — and now and then it is slightly wrong, or invents one that does not exist. Learn the habit that keeps you safe: ask, then run it yourself to check.

What you'll build

An AI will happily explain any function — and now and then it is slightly wrong, or invents one that does not exist. Learn the habit that keeps you safe: ask, then run it yourself to check.

Requirements

The must-do parts. If any are missing, we'll ask you to take another pass.

  1. Pick one function you are curious about — random.randint is a good start. Ask an AI to explain it: what it does, what goes in the brackets, and what comes out. Use the starter prompt.
  2. Take the example the AI gives you and run it in Colab — actually run it, do not just read it.
  3. Say clearly whether the AI was right, or where it was off (wrong argument order, a typo, or a function that does not really exist). One or two sentences is enough.
  4. Then do the same loop once more — ask, run, check — for a function you have NOT used before, from any library.
Bonus, if you're feeling brave
  • Deliberately ask the AI about a function that does not exist (make one up, like random.luckynumber). See what it claims, then check in Colab and write down what happened. This is how you learn to catch a confident-but-wrong answer.

Examples

What your program should look like when it runs. Lines starting with $ are typed by you; the rest is your program.

Ask, run, then check the AI against what really happens
# The AI said: random.randint(1, 6) gives a whole number from 1 to 6,
# both ends included.
import random

print(random.randint(1, 6))   # -> 4
print(random.randint(1, 6))   # -> 1
# Ran it ten times: never saw 0 or 7. The AI was right.

Where to start

Copy this scaffold into a new file. You don't have to use it — it's just a friendly nudge.

Paste this into any AI assistant. Swap in any function you want to check.

I'm a beginner in Python. Explain the function random.randint:
  - what does it do, in one plain sentence?
  - what goes inside the brackets, and in what order?
  - give me one example I can paste into Colab and run.

Then tell me one common mistake people make with it.

How we'll grade it

Four checks, four points. Three or above is passing — we'll ask you to revise anything we can't tick.

CheckWhat we look forPt
Asked a focused questionThe prompt names one specific function and asks what goes in and what comes out.1
Ran the exampleThe AI's example was actually run in Colab, and the output is shown.1
Checked the answerYou state plainly whether the AI was right — and if not, what was off.1
Did it twiceThe same ask-then-verify loop was repeated for a second, unfamiliar function.1
Ready?
Hand it in
You can submit a draft and revise later if you're not done.
Begin submission →