Rite IV. Naming the Spell
Rite IV: Naming the Spell
To name a thing is to bind it. To speak it is to summon it. To use it is to know it.
You’ve now repeated the rituals of others. But the true sorcerer writes their own spells. In this rite, you will learn to define your own functions — named commands that accept offerings (inputs), perform rites (logic), and return essence (outputs).
You will also meet a new companion: return
, the act of sealing your spell’s power into a result.
I. Your First Spell: Defining a Function
def chant():
print("The sigil pulses. The air hums.")
-
def
begins the definition -
chant
is the spell’s name -
()
holds offerings (none, yet) -
:
opens the ritual body -
print(...)
is what the spell does
To cast it:
chant()
II. Adding Offerings (Parameters)
def inscribe(sigil):
print(f"You carve the symbol: {sigil}")
Now the spell accepts an offering — sigil
— and personalizes the ritual.
inscribe("Flame")
inscribe("Void")
You can name your parameters anything, but use words of power. The spell must mean something to you.
III. Returning Power (return
)
def reverse(word):
return word[::-1]
[::-1]
slices the word backward (a mirror spell). return
gives the result back to the caller.
sigil = reverse("Ashes")
print(sigil)
Output: sehsA
IV. Combining Spells
def chant(sigil, times):
for i in range(times):
print(f"{i+1}: {sigil}")
You can now loop inside your spell. Rituals within rituals. Nesting power.
chant("Oblivion", 3)
V. Your Trial: The Sigil Forge
Craft a function that:
- Accepts a list of words (sigils)
- Reverses each one
- Returns the new list
def forge(sigils):
new_sigils = []
for sigil in sigils:
new_sigils.append(sigil[::-1])
return new_sigils
Test it:
original = ["Flame", "Stone", "Blood"]
crafted = forge(original)
print("Forged sigils:")
for sigil in crafted:
print(sigil)
VI. Reflection: The Name and the Flame
You now know:
-
def
— to define a new ritual - Parameters — offerings passed into a function
-
return
— to give back a result - Nesting — invoking loops or logic inside a spell
- Reusability — writing code once, using it many times
With this power, you are no longer reciting. You are creating. Naming. Defining. You are beginning to shape the logic of the daemon itself.