DEV Community

naixeu
naixeu

Posted on

For loop factorial user input

hello, im just a newbie in python :)
any help will be appreciated

i need to get this kind of output:

  • example i asked user to enter a number
  • the user entered 5 required output: 5! = 5*4*3*2*1

i tried it many times but my output is very different from the required output

we are only required to use for loop to this (user input)

thank you in advance

Top comments (1)

Collapse
 
arlenedotcom profile image
naixeu

this is my code btw

import math

numberadded = int(input("enter a number: "))
for n in range(numberadded+1):
print("*", n, end = "", sep = "")