Answered step by step
Verified Expert Solution
Question
1 Approved Answer
NOTE: there is more than one solution that will fix this error, you must choose the best that makes the code the most readable. What
NOTE: there is more than one solution that will fix this error, you must choose the best that makes the code the most readable. What would be the best solution to fix the following error area = PI * r ** 2 builtins. NameError: name 'r' is not defined when the following function call is made: print_circle_area(2.5) And the program has the following lines of code: PI = 3.14 def print_circle_area (radius: float): calculates and prints the area of a circle of the given radius >>> print_circle_area(2.5) 19.625 area = PI * r ** 2 print(area) add the line r = 2.5 as the first line of code within the function body change the argument name from radius to r in the function definition define r with a value of 2.5 at global scope answer is not shown changer to radius in the line: area = Pl*r ** 2
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started