def x(n): a = 1 for i in range(1, n+1): a = a * (i - 1) + i return a # Assuming the input for n will be given here n = int(input("Enter a number: ")) result = x(n) print(result)
Standard input is empty
Enter a number:
Traceback (most recent call last): File "./prog.py", line 8, in <module> EOFError: EOF when reading a line