100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4,6 TrustPilot
logo-home
Exam (elaborations)

CS 1101 Unit 2 Programming Assignment: Complete Guide and Solutions for 2026/2027

Rating
-
Sold
-
Pages
5
Grade
A+
Uploaded on
04-01-2026
Written in
2025/2026

Prepare for your CS 1101 Unit 2 Programming Assignment with this comprehensive guide. This resource includes step-by-step solutions, key programming concepts, and expert tips to help you successfully complete your assignment and improve your coding skills for the 2026/2027 semester.

Show more Read less
Institution
Computer Tech
Course
Computer Tech









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Computer Tech
Course
Computer Tech

Document information

Uploaded on
January 4, 2026
Number of pages
5
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

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)

, 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.

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
allowaysbest stuvia
Follow You need to be logged in order to follow users or courses
Sold
1902
Member since
5 months
Number of followers
0
Documents
550
Last sold
2 days ago

4,7

535 reviews

5
404
4
119
3
8
2
4
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions