Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Earlier in this assignment, you were asked to implement a particular formula as a script which took input from the user and printed output on

Earlier in this assignment, you were asked to implement a particular formula as a script which took input from the user and printed output on the screen. For this problem, you are going to implement the same formula as a function. In other words, you need to write a function that takes multiple numeric arguments (not input from the keyboard!) and that returns the result of the formula (not printing the output on the screen!). Include this function definition in the lab3.py script.

Hint: This is a pure function. If you're using input() or print() in your function definition, your function will be rejected. In fact, the whole point of this particular problem is to make sure you understand the difference.

the formula earlier in the assignment is:

print("This program will find the volume of a triangle.") a = float(input("Enter height of a triangle (in centimeters): ")) b = float(input("Enter base of a triangle (in centimeters): ")) c = float(input("Enter length of a triangle (in centimeters): "))

print('the volume of the triangle is:', (a*b*c)/2, 'cubic centimeters.')

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

Students also viewed these Databases questions

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago