0% found this document useful (0 votes)
4 views3 pages

Python Functions for Circle and Catalog

Introduction to programming

Uploaded by

ifeyinwaedith21
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Python Functions for Circle and Catalog

Introduction to programming

Uploaded by

ifeyinwaedith21
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

The code for my print_circum is def print_circum(): The code was assigned an argument for the

circle’s reduce and the print statement displayed the circle’s circumference which was calculated

by 2πr where is π 3.14159. The” print_circum” function was called three times with different

values for radius and they all gave different output. All were rounded to five decimal places.
PART 2

This is a catalog of three items in “Edith’s grocery store”. Here “def catalog() was used to create

the function before assigning variables to it.

In the function values were assigned to variables with integers and mathematical equations

involving the previously assigned variables. And the print command was used to format the

catalog to match the example output in the given assignment. This catalog showed the prices of

three items in the store and combo offers available on those items. It also showed the percentage

of discount a customer gets for each combo purchased.

FEATURES

Defining (def) is used to define the function and also keep it local.

Print statement is the command used to format and display the output in the order it appeared

(Downey, A. (2015). Think Python: How to think like a computer scientist).

You might also like