In [4]:
def cool():
'''
say hello function
'''
print('hello')
In [5]:
cool()
In [8]:
def greeting(name):
print('hello %s' %name)
In [9]:
greeting('jose')
In [11]:
def add_num(num1,num2):
return num1+num2
print(add_num('uptown','funk'))
In [21]:
import math
def is_prime(num):
'''
naive method of chking for primes
'''
if num % 2 == 0 and num > 2:
return False
for n in range(3, int(math.sqrt(num)) + 1, 2):
if num % n == 0:
return False
return True
In [22]:
is_prime(16)
Out[22]:
In [23]:
is_prime(7919)
Out[23]:
In [ ]: