Your First Words

Part of the free Generative AI course on LogicWiz — module: Awakening the Machine.

Episode 1: Your First Words

"Every AI empire starts with a single line of code."


The Journey Begins

Welcome, future AI builder.

You're about to embark on an ambitious journey. By the end of this course, you'll build Nova — your own intelligent AI assistant that can think, remember, and act autonomously.

But Nova doesn't exist yet. Right now, she's just an idea — a spark waiting to become intelligence. And before you can teach a machine to think, you need to speak its language.

That language is Python.

Why Python Rules the AI World

Python is the primary language for AI development.

  • Simplicity & readability makes rapid prototyping easy.
  • Libraries like PyTorch, TensorFlow, and Pandas are Python-first.
  • Cloud & APIs usually ship Python SDKs first — Python SDK is always prioritized; other languages often lag behind in private preview or beta.

Python is a high-level, interpreted, object-oriented language — your code is executed at runtime, line by line. That's perfect for experimentation in notebook-style workflows like Google Colab or Jupyter.

Every major AI breakthrough — GPT, DALL-E, Stable Diffusion — was built with Python. If you want to build Nova, this is where you start.


Teaching Your Machine to Speak: print()

The very first thing any program does is communicate. Let's teach your machine its first words.

Python has built-in functions like print() that are readily available.

print("Hello! Today is a great day to learn Python")

You can pass multiple arguments to print():

var = 10
rav = 30
print(var, rav)   # Output: 10 30

Giving Your Machine Memory: Variables

Your machine can speak, but it can't remember anything yet. A variable is how you give it memory — a name that refers to a value. You don't need to declare the data type — just assign a value.

age = 30            # int
height = 5.75       # float
name = "John Doe"   # str
is_student = True   # bool
  • age = 30 means "age is assigned the value 30"
  • name = "John Doe" — double quotes indicate a string (text)
  • is_student = True — not in quotes, so it's a boolean

Nova preview: When Nova eventually processes a user's question, she'll store the query in a variable, the user's name in another, and the AI's response in a third. Variables are everywhere in AI systems.

Dynamic Typing

Python uses dynamic typing: a variable's type is automatically inferred and can change when you reassign it.

a = 10
print(type(a))   # <class 'int'>

a = 6.2
print(type(a))   # <class 'float'>

a = "abc"
print(type(a))   # <class 'str'>

You can use the type() function at any time to check a variable's current type.

{{cell:l1-try-variables}}


The Building Blocks of Intelligence: Core Data Types

Type Example Notes
int 10 Whole numbers (no decimal)
float 3.14 Decimal numbers (always have a decimal component)
str "hello" Text in quotes
bool True / False Must be capitalized

Other important types include list, tuple, set, and dictionary — these are covered in Lesson 3.

Important: Python is case-sensitive. Use True and False (not true / false). Boolean data types have exactly two values.


Making Your Machine Articulate: F-Strings

Your machine can remember things. But can it express them clearly? F-strings let you embed variables and expressions inside strings. Start the string with f before the opening quote.

name = "Alice"
age = 30
print(f"My name is {name} and I am {age}.")
print(f"Next year I'll be {age + 1}.")

Anything inside curly braces {} is treated as a variable or expression to be resolved. The braces themselves are not printed — the value replaces them.

age = 30
print(f"Age: {age} (type: {type(age)})")
# Output: Age: 30 (type: <class 'int'>)

{{cell:l1-try-fstrings}}

Nova preview: F-strings will be essential when Nova builds prompts for AI models — dynamically inserting user questions, retrieved context, and instructions into formatted text.


Teaching Your Machine Math: Operators

Arithmetic Operators

Operator Meaning Example Result
+ add 9 + 5 14
- subtract 9 - 5 4
* multiply 9 * 5 45
/ divide 9 / 5 1.8
% modulus (remainder) 9 % 5 4
** exponentiation 2 ** 10 1024
// floor division (quotient) 9 // 5 1

The + operator identifies its operands: with integers it does addition, with strings it does concatenation. Since Python doesn't declare variable types, it interprets at runtime.

{{cell:l1-try-arithmetic}}

Comparison Operators

Comparison operators return True or False (boolean output).

x = 10
y = 20
print(f"x == y? {x == y}")   # Equal to → False
print(f"x != y? {x != y}")   # Not equal to → True
print(f"x > y? {x > y}")     # Greater than → False
print(f"x < y? {x < y}")     # Less than → True
print(f"x >= y? {x >= y}")   # Greater than or equal → False
print(f"x <= y? {x <= y}")   # Less than or equal → True

Use double equals == for comparison (not single = which is assignment).

Logical Operators

Logical operators combine boolean expressions. They take boolean inputs and return boolean outputs.

x, y = 10, 20
print(x > 0 and y > 0)    # True — both must be true
print(x > 100 or y > 0)   # True — at least one must be true
print(not x < 0)           # True — reverses the result
p = True
q = False
print(type(p and q))   # <class 'bool'>
print(p or q)           # True — or chooses True
print(not p)            # False — negates the logic

The in Operator

name = "Alice"
print("A" in name)    # True — checks if value is present
print("z" in name)    # False

The is and is not Operators

is checks whether two variables refer to the same object in memory (not just equal values).

x = 10
y = 20
print(x is y)       # False — different objects
print(x is not y)   # True

{{cell:l1-try-comparison}}


Mission 1: Prove You Can Speak the Language

In your first mission, you'll prove you can communicate with machines:

  • Create variables and verify their types with type()
  • Use f-strings to build formatted output
  • Perform arithmetic calculations
  • Build a small calculator-style function

Complete this mission to earn the title: Code Initiate

Next up: Your machine can remember values and do math. But AI lives in text — prompts, responses, entire conversations. In the next episode, you'll master the art of manipulating strings — the very medium AI thinks in. Nova's voice is about to get a lot more sophisticated...