Created
February 15, 2024 00:42
-
-
Save aaclarker/a24f1cb98e438b08b7489489ba92e6e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
choice = "y" | |
while choice.lower() == "y": | |
number = int(input("Enter a number to calculate factorial: ")) | |
result = 1 | |
for i in range(1, number + 1): | |
# Factorial = 1 x 2 x 3 x ... x n | |
result *= i | |
print(number, "factorial is", result) | |
choice = input("Calculate another? y/n: ") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment