3/2026,
10/13/2026,
1:58:15
10/13/2026,
1:58:15
AMCS1:58:15
1101
AMCS–
1101
AMCS
Unit–
21101
Programming
Unit–
2 Programming
Unit 2 Assignment
Programming
Assignment
q(*((&#*!(*#*($$(*($(*$Y(&*&$(*)&*)((&$*^$&*&$
Assignment
q(*((&#*!(*#*($$(*($(*$Y(&*&$(*)&*)((&$*^$&*&$
q(*((&#*!(*#*($$(*($(*$Y(&*&$(*)&*)((&$*^$&*&$
(&*$ **F
(&*$
VJyvhjbnoP+_IREOLKDJ(UWRORWUOI
**F
(&*$
VJyvhjbnoP+_IREOLKDJ(UWRORWUOI
**F VJyvhjbnoP+_IREOLKDJ(UWRORW
CS 1101 – Unit 2 Programming Assignment
Benjamin Ifeoluwa Adebayo
University of the People
CS 1001 - Programming Fundamentals
26th November, 2025
Part 1: Function to Print Circumference of a Circle
Explanation of the Code
The circumference of a circle is calculated with the formula: Circumference = 2×π×r2×π×r
Where:
● (π = 3.14159 (≅ 3.142) )
● ( r ) is the radius of the circle
The function print_circum takes the radius as an argument, performs the calculation using
Python’s arithmetic operators, and prints the result. Calling the function three times shows it works
for different circle sizes.
Python Code for Part 1
# Function to calculate and print the circumference of a circle
def print_circum(radius):
pi = 3.14159
circumference = 2 * pi * radius
print("The circumference for radius", radius, "is:", circumference)
# Calling the function three times with different radius values
print_circum(3)
print_circum(7.5)
print_circum(10)
3/2026,
10/13/2026,
1:58:15
10/13/2026,
1:58:15
AMCS1:58:15
1101
AMCS–
1101
AMCS
Unit–
21101
Programming
Unit–
2 Programming
Unit 2 Assignment
Programming
Assignment
q(*((&#*!(*#*($$(*($(*$Y(&*&$(*)&*)((&$*^$&*&$
Assignment
q(*((&#*!(*#*($$(*($(*$Y(&*&$(*)&*)((&$*^$&*&$
q(*((&#*!(*#*($$(*($(*$Y(&*&$(*)&*)((&$*^$&*&$
(&*$ **F
(&*$
VJyvhjbnoP+_IREOLKDJ(UWRORWUOI
**F
(&*$
VJyvhjbnoP+_IREOLKDJ(UWRORWUOI
**F VJyvhjbnoP+_IREOLKDJ(UWRORW
,3/2026,
10/13/2026,
1:58:15
10/13/2026,
1:58:15
AMCS1:58:15
1101
AMCS–
1101
AMCS
Unit–
21101
Programming
Unit–
2 Programming
Unit 2 Assignment
Programming
Assignment
q(*((&#*!(*#*($$(*($(*$Y(&*&$(*)&*)((&$*^$&*&$
Assignment
q(*((&#*!(*#*($$(*($(*$Y(&*&$(*)&*)((&$*^$&*&$
q(*((&#*!(*#*($$(*($(*$Y(&*&$(*)&*)((&$*^$&*&$
(&*$ **F
(&*$
VJyvhjbnoP+_IREOLKDJ(UWRORWUOI
**F
(&*$
VJyvhjbnoP+_IREOLKDJ(UWRORWUOI
**F VJyvhjbnoP+_IREOLKDJ(UWRORW
Part 2: Catalog and Discount Function
Technical Explanation of the Code
In this task, a company sells three different items. A customer may buy:
● Only one item (no discount)
● A combo of two unique items (10% discount)
● A gift pack containing all three items (25% discount)
The function below:
1. Accepts a list of items purchased.
2. Calculates the price depending on how many unique items are selected.
3. Applies the correct discount using basic operators.
4. Prints the final price.
This demonstrates Python concepts such as functions, parameters, lists, conditional statements,
arithmetic expressions, and string formatting.
3/2026,
10/13/2026,
1:58:15
10/13/2026,
1:58:15
AMCS1:58:15
1101
AMCS–
1101
AMCS
Unit–
21101
Programming
Unit–
2 Programming
Unit 2 Assignment
Programming
Assignment
q(*((&#*!(*#*($$(*($(*$Y(&*&$(*)&*)((&$*^$&*&$
Assignment
q(*((&#*!(*#*($$(*($(*$Y(&*&$(*)&*)((&$*^$&*&$
q(*((&#*!(*#*($$(*($(*$Y(&*&$(*)&*)((&$*^$&*&$
(&*$ **F
(&*$
VJyvhjbnoP+_IREOLKDJ(UWRORWUOI
**F
(&*$
VJyvhjbnoP+_IREOLKDJ(UWRORWUOI
**F VJyvhjbnoP+_IREOLKDJ(UWRORW
10/13/2026,
1:58:15
10/13/2026,
1:58:15
AMCS1:58:15
1101
AMCS–
1101
AMCS
Unit–
21101
Programming
Unit–
2 Programming
Unit 2 Assignment
Programming
Assignment
q(*((&#*!(*#*($$(*($(*$Y(&*&$(*)&*)((&$*^$&*&$
Assignment
q(*((&#*!(*#*($$(*($(*$Y(&*&$(*)&*)((&$*^$&*&$
q(*((&#*!(*#*($$(*($(*$Y(&*&$(*)&*)((&$*^$&*&$
(&*$ **F
(&*$
VJyvhjbnoP+_IREOLKDJ(UWRORWUOI
**F
(&*$
VJyvhjbnoP+_IREOLKDJ(UWRORWUOI
**F VJyvhjbnoP+_IREOLKDJ(UWRORW
CS 1101 – Unit 2 Programming Assignment
Benjamin Ifeoluwa Adebayo
University of the People
CS 1001 - Programming Fundamentals
26th November, 2025
Part 1: Function to Print Circumference of a Circle
Explanation of the Code
The circumference of a circle is calculated with the formula: Circumference = 2×π×r2×π×r
Where:
● (π = 3.14159 (≅ 3.142) )
● ( r ) is the radius of the circle
The function print_circum takes the radius as an argument, performs the calculation using
Python’s arithmetic operators, and prints the result. Calling the function three times shows it works
for different circle sizes.
Python Code for Part 1
# Function to calculate and print the circumference of a circle
def print_circum(radius):
pi = 3.14159
circumference = 2 * pi * radius
print("The circumference for radius", radius, "is:", circumference)
# Calling the function three times with different radius values
print_circum(3)
print_circum(7.5)
print_circum(10)
3/2026,
10/13/2026,
1:58:15
10/13/2026,
1:58:15
AMCS1:58:15
1101
AMCS–
1101
AMCS
Unit–
21101
Programming
Unit–
2 Programming
Unit 2 Assignment
Programming
Assignment
q(*((&#*!(*#*($$(*($(*$Y(&*&$(*)&*)((&$*^$&*&$
Assignment
q(*((&#*!(*#*($$(*($(*$Y(&*&$(*)&*)((&$*^$&*&$
q(*((&#*!(*#*($$(*($(*$Y(&*&$(*)&*)((&$*^$&*&$
(&*$ **F
(&*$
VJyvhjbnoP+_IREOLKDJ(UWRORWUOI
**F
(&*$
VJyvhjbnoP+_IREOLKDJ(UWRORWUOI
**F VJyvhjbnoP+_IREOLKDJ(UWRORW
,3/2026,
10/13/2026,
1:58:15
10/13/2026,
1:58:15
AMCS1:58:15
1101
AMCS–
1101
AMCS
Unit–
21101
Programming
Unit–
2 Programming
Unit 2 Assignment
Programming
Assignment
q(*((&#*!(*#*($$(*($(*$Y(&*&$(*)&*)((&$*^$&*&$
Assignment
q(*((&#*!(*#*($$(*($(*$Y(&*&$(*)&*)((&$*^$&*&$
q(*((&#*!(*#*($$(*($(*$Y(&*&$(*)&*)((&$*^$&*&$
(&*$ **F
(&*$
VJyvhjbnoP+_IREOLKDJ(UWRORWUOI
**F
(&*$
VJyvhjbnoP+_IREOLKDJ(UWRORWUOI
**F VJyvhjbnoP+_IREOLKDJ(UWRORW
Part 2: Catalog and Discount Function
Technical Explanation of the Code
In this task, a company sells three different items. A customer may buy:
● Only one item (no discount)
● A combo of two unique items (10% discount)
● A gift pack containing all three items (25% discount)
The function below:
1. Accepts a list of items purchased.
2. Calculates the price depending on how many unique items are selected.
3. Applies the correct discount using basic operators.
4. Prints the final price.
This demonstrates Python concepts such as functions, parameters, lists, conditional statements,
arithmetic expressions, and string formatting.
3/2026,
10/13/2026,
1:58:15
10/13/2026,
1:58:15
AMCS1:58:15
1101
AMCS–
1101
AMCS
Unit–
21101
Programming
Unit–
2 Programming
Unit 2 Assignment
Programming
Assignment
q(*((&#*!(*#*($$(*($(*$Y(&*&$(*)&*)((&$*^$&*&$
Assignment
q(*((&#*!(*#*($$(*($(*$Y(&*&$(*)&*)((&$*^$&*&$
q(*((&#*!(*#*($$(*($(*$Y(&*&$(*)&*)((&$*^$&*&$
(&*$ **F
(&*$
VJyvhjbnoP+_IREOLKDJ(UWRORWUOI
**F
(&*$
VJyvhjbnoP+_IREOLKDJ(UWRORWUOI
**F VJyvhjbnoP+_IREOLKDJ(UWRORW