# Check if f a number is a prime number - the dumb way import math v = 47 # The second argument, end='', prevents the print command to create a new line print(('Is the number {} a prime number ? ').format(v), end ='') # 1 is special with primes if v > 1: # Iterate from 2 to sqr(v), rounded up m = math.ceil(math.sqrt(v)) for i in range(2, m + 1): # If num is divisible by any number between # 2 and sqr(v)), it is not prime if (v % i) == 0: print('no') break else: print('yes') else: print('no')