Question

Primes Write a program primes.py that reads a positive integer from standard input, and determines whether or not the number
python language
0 0
Add a comment Improve this question Transcribed image text
Answer #1

ANSWER: Please indent the code according to the code image and run please like it.

CODE:

num = int(input("One positive integer please: "))

# prime num is always greater than 1
if num > 1:
for i in range(2, num):
if (num % i) == 0:
print(num, "is not a prime!")
break
else:
print(num, "is a prime!")
else:
print(num, "is not a prime!")

CODE IMAGE:

num- int (input (One positive integer please: )) 2 3 # prime num is always greater than 1 4 if num 1: for i in range(2, num

OUTPUT:

One positive integer please: 23 23 is a prime!

Add a comment
Know the answer?
Add Answer to:
python language Primes Write a program primes.py that reads a positive integer from standard input, and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT