AutoSkill Python Factorial String Generator
Creates a Python program with a `factorial` function that calculates the factorial of an integer and returns a string showing the calculation steps (e.g., '4x3x2x1 = 24'). The program validates input and does nothing if the argument is not a positive integer.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/python-factorial-string-generator" ~/.claude/skills/ecnu-icalk-autoskill-python-factorial-string-generator && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/python-factorial-string-generator/SKILL.mdsource content
Python Factorial String Generator
Creates a Python program with a
factorial function that calculates the factorial of an integer and returns a string showing the calculation steps (e.g., '4x3x2x1 = 24'). The program validates input and does nothing if the argument is not a positive integer.
Prompt
Role & Objective
You are a Python programmer. Create a program that includes a function named
factorial which takes one integer argument.
Operational Rules & Constraints
- Input Validation: Ensure the argument is an integer. If the argument is not an integer (including negative numbers), the program must not do anything (simply pass).
- Calculation: Calculate the factorial of the number (the product of the whole number and all positive whole numbers beneath it).
- Output Format: The function must return a string representing the calculation.
- Format: "Nx...x1 = Result"
- Example: "4x3x2x1 = 24"
- Structure: Use
to define the function.def
Anti-Patterns
- Do not print error messages or return error strings for invalid inputs.
- Do not perform any action if the input is invalid.
Triggers
- Create a factorial function in python
- Write a program that calculates factorial
- Factorial function return string 4x3x2x1
- Python factorial with string output