Solved–Assignment: AG02– Solution

$30.00 $19.00

Defining Functions Since you are reading this, you have already downloaded and extracted the zip file. 1.1 Tasks to do Open the file a02.py and look between the markers. You may ignore the code outside the markers completely. You may run the code by typing the following from the shell: python a02.py This will not…

You’ll get a: . zip file solution

 

 

Description

5/5 – (2 votes)
  • Defining Functions

Since you are reading this, you have already downloaded and extracted the zip file.

1.1 Tasks to do

  1. Open the file a02.py and look between the markers. You may ignore the code outside the markers completely. You may run the code by typing the following from the shell: python a02.py

This will not run the tests but the code itself.

  1. There are two main tasks to complete.

    1. Write a function with the exact name get_area which takes the radius of a circle as input and calculates the area. (You might want to import the value of pi from the math module for this calculation.)

    1. Write another function named output_parameter. This should, again, take in one number as input, consider this number as the radius of a circle and calculate the parameter of the circle.

However, you area not required to return the parameter. Instead, the function should simply output the following:

The parameter of the circle with radius (radius) is (parameter)

Where (radius) should be replaced with the radius given as input to the function and (parameter) should be replaced with the parameter you just calculated.

For example, if we give 1.0 as input to this function, it should output the following:

The parameter of the circle with radius 1.0 is 6.2831853

Make sure you output the exact message as shown above (including spaces and spellings). Otherwise, your code may not meet the specifications and would fail the tests.

  1. You may change the values in function calls at the end of the file a02.py to check the functions.

  1. Run local tests and if they pass, submit the assignment using the submission command given on the Autograder assignment page. (Same as the first assignment.)

CS101 Introduction to Computing (Fall 2017 – Assignment: AG02) Page 1 of 1