this lesson i learned for loops and while loops.
here is a while loop i wrote
num = int(input("enter a number: "))
i = 2
while i < num:
if num / i == 0:
isdevisable = True
print("{} is devisable by {}".format(num,i))
i += 1
if isdevisable:
print("{} is not a prime number".format(num))
else:
print("{} is a prime number".format(num))
here is a while loop i wrote
num = int(input("enter a number: "))
i = 2
while i < num:
if num / i == 0:
isdevisable = True
print("{} is devisable by {}".format(num,i))
i += 1
if isdevisable:
print("{} is not a prime number".format(num))
else:
print("{} is a prime number".format(num))
Comments
Post a Comment