mirror of
https://github.com/DavidGailleton/42-Piscine_Python.git
synced 2026-04-28 16:14:35 +02:00
mod 10 ex 1 WIP
This commit is contained in:
+13
-1
@@ -44,6 +44,10 @@ def pow_2(nb: int) -> int:
|
||||
return nb * nb
|
||||
|
||||
|
||||
def spell_transformer(spell: str) -> str:
|
||||
return "* " + spell + " *"
|
||||
|
||||
|
||||
def main() -> None:
|
||||
try:
|
||||
print("=== spell_combiner ===")
|
||||
@@ -60,7 +64,15 @@ def main() -> None:
|
||||
print(f"Invalid: {caster(2, str)}")
|
||||
|
||||
print("\n=== spell_sequence ===")
|
||||
sequencer = spell_sequence([fireball, heal, isinstance])
|
||||
sequencer = spell_sequence(
|
||||
[
|
||||
fireball,
|
||||
heal,
|
||||
spell_transformer,
|
||||
]
|
||||
)
|
||||
print(f"Sequence result: {sequencer('dragon')}")
|
||||
|
||||
except Exception as err:
|
||||
print(err)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user