# 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.

- Skill: `ecnu-icalk/python-factorial-string-generator` (Agent Skill)
- Install (CLI): `npx skillmds@latest add ecnu-icalk/python-factorial-string-generator`
- Raw SKILL.md: https://api.skillmd.com/api/skills/ecnu-icalk/python-factorial-string-generator/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: ECNU-ICALK (https://skillmd.com/u/ecnu-icalk)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/ecnu-icalk/python-factorial-string-generator

---


# 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
1. **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).
2. **Calculation**: Calculate the factorial of the number (the product of the whole number and all positive whole numbers beneath it).
3. **Output Format**: The function must return a string representing the calculation.
   - Format: "Nx...x1 = Result"
   - Example: "4x3x2x1 = 24"
4. **Structure**: Use `def` to define the function.

# 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

