0% found this document useful (0 votes)
4 views2 pages

AKTU Python Unit1 Notes

The document contains two Python code snippets. The first snippet calculates the factorial of a given number, while the second snippet checks if a number is prime. Both snippets utilize loops and conditional statements for their respective computations.

Uploaded by

kumar.rikky343
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

AKTU Python Unit1 Notes

The document contains two Python code snippets. The first snippet calculates the factorial of a given number, while the second snippet checks if a number is prime. Both snippets utilize loops and conditional statements for their respective computations.

Uploaded by

kumar.rikky343
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

n = int(input("Enter number: "))

fact = 1

for i in range(1, n+1):


fact = fact * i

print(fact)

n = int(input("Enter number: "))


flag = 0

for i in range(2, n):


if n % i == 0:
flag = 1
break

if flag == 0:
print("Prime")
else:
print("Not Prime")

You might also like