def calc_pizza_area(): 
    pi_val = 3.14159265

    #the function call to calc_pizza_area() jumps execution to the functions statements 
    
    pizza_diameter = 12.0 
    pizza_radius = pizza_diameter / 2.0 
    pizza_area = pi_val * pizza_radius * pizza_radius
    return pizza_area 

print(f' {12:.1f} inch pizza is {calc_pizza_area(): .3f} square inches')
#After the last statement of the calc_pizza_area() function, execution returns to the original location 
# And the area of the pizza is returned and printed. 


# A function may return one value using a return statement 

def compute_square(num_to_square):

    #Call compute_square and pass in the value 7
    return num_to_square * num_to_square 
    #Compute the square of num_to_square and return the result

num_squared = compute_square(7)
#num_squared is assigned the return value of compute_square(7)

print(f' 7 squared is {num_squared}')


Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: