• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 2 fuera de 5 páginas
Examen

CS 1101 Unit 2 Programming Assignment: Questions and Solutions Study Guide

Document preview thumbnail
Vista previa 2 fuera de 5 páginas

CS 1101 Unit 2 Programming Assignment: Questions and Solutions Study Guide

Vista previa del contenido

*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
4:03:13
4:03:13
4:03:13
AM1
AM1
AM1
ofof
5Page
of
5Page
5Page
1CS
1CS
1CS
1101
1101
1101
–
–
–
Unit
Unit
Unit
2 Programming
2 Programming
2 Programming
Assignment
Assignment
Assignment
q.docx2026/10/23Page
q.docx2026/10/23Page
q.docx2026/10/23Page
1 of
1 of
15 of
55




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)




*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
4:03:13
4:03:13
4:03:13
AM1
AM1
AM1
ofof
5Page
of
5Page
5Page
1CS
1CS
1CS
1101
1101
1101
–
–
–
Unit
Unit
Unit
2 Programming
2 Programming
2 Programming
Assignment
Assignment
Assignment
q.docx2026/10/23Page
q.docx2026/10/23Page
q.docx2026/10/23Page
1 of
1 of
15 of
55

, *@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
4:03:13
4:03:13
4:03:13
AM2
AM2
AM2
ofof
5Page
of
5Page
5Page
2CS
2CS
2CS
1101
1101
1101
–
–
–
Unit
Unit
Unit
2 Programming
2 Programming
2 Programming
Assignment
Assignment
Assignment
q.docx2026/10/23Page
q.docx2026/10/23Page
q.docx2026/10/23Page
2 of
2 of
25 of
55




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.




*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
4:03:13
4:03:13
4:03:13
AM2
AM2
AM2
ofof
5Page
of
5Page
5Page
2CS
2CS
2CS
1101
1101
1101
–
–
–
Unit
Unit
Unit
2 Programming
2 Programming
2 Programming
Assignment
Assignment
Assignment
q.docx2026/10/23Page
q.docx2026/10/23Page
q.docx2026/10/23Page
2 of
2 of
25 of
55

Información del documento

Subido en
24 de octubre de 2026
Número de páginas
5
Escrito en
2026/2027
Tipo
Examen
Contiene
Preguntas y respuestas
$10.99

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
Brainey
4.8
(354)
Vendido
4787
Seguidores
11
Artículos
1570
Última venta
1 día hace



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes