Issue
The code I run:
def areatriangle(base, height):
area = .5 * base * height
print("Area of the triangle of base",base,"and height",height,"is", area)
The output I get:
runfile('C:/Users/Admin/Desktop/Python/spyder/Exercises.py', wdir='C:/Users/Admin/Desktop/Python/spyder')*
Solution
(Spyder maintainer here) runfile
is the command used by Spyder to run a file in the console. So every time you run files from the Editor, you'll see it displayed in the console and there's nothing wrong with that.
Besides that, you are not seeing any other result because you're not calling the areatriangle
function, you are simply declaring it and that doesn't produce any result. So, you need to add the following to your code
def areatriangle(base, height):
area = .5 * base * height
print("Area of the triangle of base",base,"and height",height,"is", area)
areatriangle(1, 2)
and then you'll see the following
Answered By - Carlos Cordoba
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.