Python: run, inspect, change
Learning goal
Use variables, conditions, and functions in the browser.
Python is widely used for AI because libraries such as NumPy and scikit-learn provide numerical and machine-learning tools. PES runs Python in the browser using Pyodide. Loading the runtime and packages takes time. Printing a greeting checks that code runs; it does not train an AI model.
A closer look
The example below applies a rule written by a person. Change the score or threshold and predict the output before running it. A function uses return to give a value back; print only displays it. Test boundary cases such as a score exactly equal to the threshold. This rule-based program has no learning step.
Explain it yourself
A programmer changes an if-condition. Did the program learn from data?
Compare with an explanation
No. Editing a rule is programming. Learning requires a process that derives model behavior from data.
You mark this yourself. Nothing is graded here.
Mark this step as understood?
This cannot be undone yet, so mark it only when you really understand.
Marked as understood
You mark this yourself. Nothing is graded here.
Sources and further reading
question = "What is AI?"
if "AI" in question:
answer = "AI is software for tasks such as prediction and generation."
else:
answer = "Please give more context."
print(answer)