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
|
return nb * nb
|
||||||
|
|
||||||
|
|
||||||
|
def spell_transformer(spell: str) -> str:
|
||||||
|
return "* " + spell + " *"
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
try:
|
try:
|
||||||
print("=== spell_combiner ===")
|
print("=== spell_combiner ===")
|
||||||
@@ -60,7 +64,15 @@ def main() -> None:
|
|||||||
print(f"Invalid: {caster(2, str)}")
|
print(f"Invalid: {caster(2, str)}")
|
||||||
|
|
||||||
print("\n=== spell_sequence ===")
|
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:
|
except Exception as err:
|
||||||
print(err)
|
print(err)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user