Jan-24-2021, 08:09 PM
(This post was last modified: Jan-24-2021, 08:10 PM by BashBedlam.)
I tried the first example. The code I entered produced the correct result when run in my system but produced errors when run in you online interpreter. Here's my code:
# Move this code into a function `is_prime(test_num)` def is_prime(test_num): num = 2 test_num_is_prime = True while num <= float(test_num / 2): if test_num % num == 0: test_num_is_prime = False break num += 1 if test_num_is_prime: print("%d is prime" % test_num) else: print("%d is not prime" % test_num) # Input handling, do not modify below this line is_prime(int(input()))