31 lines
475 B
Python
31 lines
475 B
Python
def say_hello():
|
|
print('Hello World!')
|
|
|
|
|
|
def area_of_square(length):
|
|
return length**2
|
|
|
|
|
|
def area_of_circle(radius):
|
|
pi = 3.1415926
|
|
return pi*radius**2
|
|
|
|
# pi can also be defined outside of the function
|
|
# good and bad?
|
|
# what if someone change the value outside?
|
|
|
|
|
|
def area_of_rectangle(length,width):
|
|
return length*width
|
|
|
|
|
|
|
|
def app():
|
|
age = int(input('What\'s your age?'))
|
|
print('Your age is {}'.format(age))
|
|
print('-------')
|
|
app()
|
|
|
|
app()
|
|
|