You are on page 1of 1

Programming assignment Unit2 (Part 1-2)

Part 1
Part 1
 There are a lot of different ways to get this the
Circumference of a circle, here is the shortest
way to get the method done.
1- First, we create a variable called “π” and give it
The value 3.14159
2- Second, we create a function and give it a name
“print-circum” , then we give it a “Parameter”
3- Here the third step is to give an “Argument” to
The function.
4- Finally, we call the function.
 We could do it in another solution, but it would be longer than the pervious example.
For example:-
π= 3.14159
radius=3
circle1=radius
circle2=radius+1
circle3=radius+2
def print_circum(radius):
print(2*π*radius)
print_circum(circle1)
print_circum(circle2)
print_circum(circle3)

Part 2
The Code
- In this method we creates the function
then we input the full details we have
as a print order to imitate the example
on the university page, before we name
the items and price we give a 3 parameters
to use them in our function, it is all about
sequence in the data, then we add the three
combos with the 2 types of discounts by
multiplication method(*0.9)to get the 10%
and (*0,75) to get the 25% discount. Then
we add the other required details to the code. ------------------------------------------------------------------------------------------
The Result

The Final Result =

The output is just typically as it is in


the example on the university page.

Refrenceses :-
Think python
Chapter Function 3.1, 3.2
Pages 17, 18

You might also like