Salesforce interview question

String manipulation, factorial in python