Advertisement
uopspop

Untitled

Sep 19th, 2018
418
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Wed Sep 19 14:19:16 2018
  4.  
  5. @author: sam
  6. """
  7.  
  8. # create a function to calculate the area of a triangle
  9. def calculateTriangle( base, height ):
  10.     # the operation multiplies 1/2 by base and then multiplies the result by height
  11.     area = (1/2) * base * height
  12.     return area;
  13.  
  14. # assign the value 12 to the variable base_input
  15. base_input = 12
  16. # assign the value 16 to the variable height_input
  17. height_input = 16
  18.  
  19. # assign the result of the operation to the variable area_output
  20. area_output = calculateTriangle(base_input,height_input)
  21.  
  22. # print the value of area_output
  23. print(area_output);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement