document.write(`
<style>
body {
font-family: Arial, sans-serif;
background: #ffffff;
color: #222;
max-width: 750px;
margin: 0 auto;
padding: 30px 20px;
line-height: 1.7;
font-size: 15px;
}
h1 { font-size: 1.5rem; border-bottom: 2px solid #222; padding-bottom: 8px; margin-bottom: 24px; }
h2 { font-size: 1.1rem; margin-top: 36px; margin-bottom: 8px; color: #111; }
p { margin-bottom: 10px; }
pre {
background: #f4f4f4;
border-left: 4px solid #555;
padding: 14px 18px;
font-family: 'Courier New', monospace;
font-size: 0.88rem;
line-height: 1.7;
overflow-x: auto;
margin: 12px 0;
}
code {
background: #f0f0f0;
padding: 1px 5px;
font-family: 'Courier New', monospace;
font-size: 0.88rem;
}
table {
width: 100%;
border-collapse: collapse;
margin: 12px 0;
font-size: 0.91rem;
}
th {
background: #222;
color: #fff;
padding: 8px 12px;
text-align: left;
}
td {
padding: 8px 12px;
border-bottom: 1px solid #ddd;
}
tr:nth-child(even) td { background: #f9f9f9; }
.tick { color: green; }
.cross { color: red; }
hr { border: none; border-top: 1px solid #ddd; margin: 36px 0; }
.activity {
margin-top: 16px;
}
.activity p {
font-weight: bold;
margin-bottom: 6px;
}
</style>
<h1>Lesson 1 — Variables, Expressions & Statements</h1>
<h2>Print Statements</h2>
<p><code>print()</code> displays text on the screen. Text must be wrapped in quotes — single or double both work.</p>
<pre>print("Hello, World!")
print('Python is great')</pre>
<div class="activity">
<p>Activity 1:</p>
` + AB.launchWorld( "9778384549", "Activity 1" ) + `
</div>
<hr>
<h2>Variables</h2>
<p>A variable is a labelled box that stores a value. You give it a name, use <code>=</code> to put something inside, and then refer to that name anywhere in your code.</p>
<pre>name = 'Alice'
age = 18
height = 1.65
print(name)
print(age)
print(height)</pre>
<p>There are three data types used above:</p>
<table>
<tr><th>Type</th><th>Example</th><th>Description</th></tr>
<tr><td><code>str</code></td><td><code>"Alice"</code></td><td>Text — always in quotes</td></tr>
<tr><td><code>int</code></td><td><code>18</code></td><td>Whole number</td></tr>
<tr><td><code>float</code></td><td><code>1.65</code></td><td>Decimal number</td></tr>
</table>
<div class="activity">
<p>Activity 2:</p>
` + AB.launchWorld( "3674230093", "Activity 2" ) + `
</div>
<hr>
<h2>Rules for Naming Variables</h2>
<table>
<tr><th>Example</th><th></th><th>Reason</th></tr>
<tr><td><code>first_name</code></td><td><span class="tick">✓ Allowed</span></td><td>Underscores replace spaces</td></tr>
<tr><td><code>score1</code></td> <td><span class="tick">✓ Allowed</span></td><td>Numbers are fine — just not at the start</td></tr>
<tr><td><code>1score</code></td> <td><span class="cross">✗ Not allowed</span></td><td>Cannot start with a number</td></tr>
<tr><td><code>first name</code></td><td><span class="cross">✗ Not allowed</span></td><td>No spaces allowed</td></tr>
<tr><td><code>class</code></td> <td><span class="cross">✗ Not allowed</span></td><td><code>class</code> is a reserved Python keyword</td></tr>
</table>
<div class="activity">
<p>Activity 3:</p>
` + AB.launchWorld( "3106006044", "Activity 3" ) + `
</div>
<hr>
<h2>Maths and Expressions</h2>
<p>Python supports all standard maths operations. It follows BIMDAS, so brackets are evaluated first.</p>
<table>
<tr><th>Symbol</th><th>Operation</th><th>Example</th><th>Result</th></tr>
<tr><td><code>+</code></td> <td>Addition</td> <td><code>10 + 3</code></td> <td>13</td></tr>
<tr><td><code>-</code></td> <td>Subtraction</td> <td><code>10 - 3</code></td> <td>7</td></tr>
<tr><td><code>*</code></td> <td>Multiplication</td> <td><code>10 * 3</code></td> <td>30</td></tr>
<tr><td><code>/</code></td> <td>Division</td> <td><code>10 / 3</code></td> <td>3.333…</td></tr>
<tr><td><code>//</code></td><td>Floor division</td> <td><code>10 // 3</code></td> <td>3 (whole number only)</td></tr>
<tr><td><code>%</code></td> <td>Modulo</td> <td><code>10 % 3</code></td> <td>1 (remainder)</td></tr>
<tr><td><code>**</code></td><td>Exponentiation</td> <td><code>10 ** 3</code></td> <td>1000 (10³)</td></tr>
</table>
<pre>x = 10
y = 3
print(x + y) # 13
print(x - y) # 7
print(x * y) # 30
print(x / y) # 3.333...
print(x // y) # 3
print(x % y) # 1
print(x ** y) # 1000
print((2 + 3) * 4) # 20 -- brackets first</pre>
<div class="activity">
<p>Activity 4:</p>
` + AB.launchWorld( "9765684253", "Activity 4" ) + `
</div>
<hr>
<h2>Getting Input from the User</h2>
<p><code>input()</code> pauses the program and waits for the user to type something. Whatever they type is always returned as a string. We use <code>await</code> because AncientBrain handles input asynchronously.</p>
<pre>user_name = await input("What is your name? ")
print("Nice to meet you,", user_name)</pre>
<p>Because <code>input()</code> always returns text, you must convert it before doing any maths:</p>
<pre>user_age = await input("How old are you? ")
user_age = int(user_age) # convert text to whole number
next_birthday = user_age + 1
print("Next year you will be", next_birthday)</pre>
<table>
<tr><th>Function</th><th>Converts to</th><th>Example</th></tr>
<tr><td><code>int()</code></td> <td>Whole number</td> <td><code>int("17")</code> → 17</td></tr>
<tr><td><code>float()</code></td><td>Decimal number</td> <td><code>float("1.65")</code> → 1.65</td></tr>
<tr><td><code>bool()</code></td> <td>True / False</td> <td><code>bool(1)</code> → True</td></tr>
</table>
<div class="activity">
<p>Activity 5:</p>
` + AB.launchWorld( "0224952529", "Activity 5" ) + `
</div>
`);