I am trying to make a calculator in python where you can add, subtract, multiply, divide, find the exponential, find the nth root of x and also for factorial of a number.
While trying to finish the calculator I realized there was a problem with calculating the factorial of a number with decimal as there is not thing called factorial of a number with a decimal.
Here is the code for factorial that I used.
a = float(input("Enter the first number: "))
ab = 1
ac = a
if a > 1:
while a > 1:
ab = ab*a
a = a - 1
print (ac,"factorial is",ab)
elif a == 0:
print("0 factorial is 1")
else:
print("There is no negetive factorial")
I tried to search for any code that could work out, but I still couldn't find any code for that.
I also tried to edit the above code like this.
a = float(input("Enter the first number: "))
ab = 1
ac = a
if not(a/1):
print("there is no factorial of number with decimal")
else:
if a > 1:
while a > 1:
ab = ab*a
a = a - 1
print (ac,"factorial is",ab)
elif a == 0:
print("0 factorial is 1")
else:
print("There is no negetive factorial")
Still, It doesn't do anything.