Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 1 Step 1: In the editor window, type this function definition below the comment, # Exercise 1. Remember that function and parameter names, by

image text in transcribed

Exercise 1 Step 1: In the editor window, type this function definition below the comment, \# Exercise 1. Remember that function and parameter names, by convention, do not contain uppercase letters, and names made up of two or more words must be written in pothole_case. def area_of_disk(radius: float) float: ""neturn the area of a disk with the specified radius. Precondition: radius >=0. > area_of_disk (5) 78.54 "n" return math.pi radius ** 2 Don't copy/paste code from PDF files into the Wing 101 editor. Doing this may transfer non-displayable characters that Python doesn't recognize, triggering errors when you save the file or run the code. Because these characters aren't shown on the screen, locating them and removing them from the source code can be tedious. After you've typed the code, save the edited file. To do this, click the Save button in the toolbar 2 (it looks like a 3.5-inch floppy disk) or select File > Save from the menu bar. Note: at any time, if you take a break from working on this lab, you can close the file by selecting File > Close from the menu bar. The editor window will no longer be displayed. When you resume working on the exercises, reopen the file by clicking the Open a file button on the toolbar - it looks like an open file folder - or select File > Open... from the menu bar. Step 2: Click the Run button (the green triangle in the toolbar). This will load lab4.py into the Python interpreter and check it for syntax errors. If any syntax errors are reported, edit the function to correct the errors, save the edited file, then click Run. Step 3: Interactively test area_of_disk by typing these call expressions (function calls) in the shell. Python will display the value that each function call returns; that is, the value of the call expression. Use a calculator to verify that the values returned by area_of_disk are correct. > area_of_disk(5) area_of_disk(5.0) > area_of_disk (1.0+3) > diameter =10.0 area_of_disk(diameter / 2)

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

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions