Hi, Python Learners! I'm building out assignments to help people learn Python. Here's the latest one on control flow, which includes conceptual questions and coding questions pertaining to functions, if statements, booleans, and loops. Enjoy!
https://open.openclass.ai/resource/assig...1VwbZ_3z8Q
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()))