The lateral surface area of a right-circular cone (a right cone with a base that is a circle) can be calculated by the function: f: h, r → f(h, r); f(h, r) 2 2 = πr x₁√√√√² +h² where h is the height of the cone and r is the radius of the circular base.
The lateral surface area of a right-circular cone (a right cone with a base that is a circle) can be calculated by the function: f: h, r → f(h, r); f(h, r) 2 2 = πr x₁√√√√² +h² where h is the height of the cone and r is the radius of the circular base.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
finish the function definition please and thank you!

Transcribed Image Text:The lateral surface area of a right-circular cone (a right cone with a base that is a circle) can be
calculated by the function:
2
2
√r² +h²
where h is the height of the cone and r is the radius of the circular base.
f: h, r → f(h, r); f(h, r) = πY X 1

Transcribed Image Text:def area_of_cone (height, radius):
This function will return the lateral surface area of a right circular cone with the specified
positive height and radius. Complete the function definition. For the value of л, use variable pi
from the math module. Python's math module also has a function that calculates square roots.
To find out about this function, use Python's help facility. In the shell, type:
Expert Solution

Step 1
Answer:
import math
def area_of_cone(height,radius):
if height<=0 or radius<=0:#To handle negative and zero inputs
return 0.0
else:#For other non-negative inputs
return math.pi*radius*math.sqrt((radius**2)+(height*2))
#Test Case 1: Positive input: height=5 units, radius=3 units
#Test Case 2: Zero input: height=0 unit, radius=0 unit
#Test Case 3: Negative input : height=-1 unit, radius=-5 units
area=area_of_cone(5,3)
area=area_of_cone(0,0)
area=area_of_cone(-1,-5)
Step by step
Solved in 2 steps

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education