Issue
num = 3 #take input from the user
if num > 1: # if input is greater than 1 check for factors
for i in range(2,num):
if (num % i) == 0:
print(num,"is not a prime number")
break
else:
print(num,"is a prime number")
#if input number is less than or equal to 1, it is not prime
else:
print(num,"is not a prime number")
I have my code here which works out the prime number of the num section, what I need to do it ask the user for the input when I run the code.
Solution
This is pretty straightforward:
num = int(input("Input a number: "))
Answered By - ForceBru
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.