CS1101-Unit02 programming assignment

.docx

School

University of the People *

*We aren’t endorsed by this school

Course

1101

Subject

English

Date

Jan 9, 2024

Type

docx

Pages

5

Uploaded by BaronEmuPerson965

Report
Part 1: The code for my print_circum function: >>> def print_circum(radius): ... print(2 * 3.14159 * radius) The inputs and outputs to three calls of my print_circum function: >>> print_circum(1) 6.28318 >>> print_circum(15.5) 97.38929 >>> print_circum(250) 1570.7949999999998
Part 2: Code of the function I created: def print_catalog(): item1_price = 200.0 item2_price = 400.0 item3_price = 600.0 combo_discount = 0.10 giftpack_discount = 0.25
combo1_price = item1_price + item2_price - combo_discount * (item1_price + item2_price) combo2_price = item2_price + item3_price - combo_discount * (item2_price + item3_price) combo3_price = item1_price + item3_price - combo_discount * (item1_price + item3_price) combo4_price = item1_price + item2_price + item3_price - giftpack_discount * (item1_price + item2_price + item3_price) dash_rule = '- ' * 20 line_rule = '-' * 40 print("Online Store") print(dash_rule) print( f"{'Product(s)':<30}{'Price':>10}", f"\n{'Item 1':<30}{item1_price:>10}", f"\n{'Item 2':<30}{item2_price:>10}", f"\n{'Item 3':<30}{item3_price:>10}", f"\n{'Combo 1 (item 1 + 2)':<30}{combo1_price:>10}", f"\n{'Combo 2 (item 2 + 3)':<30}{combo2_price:>10}", f"\n{'Combo 3 (item 1 + 3)':<30}{combo3_price:>10}", f"\n{'Combo 4 (item 1 + 2 + 3)':<30}{combo4_price:>10}", ) print(line_rule) print("For delivery Contact: 98764678899") Output of the code: Online Store - - - - - - - - - - - - - - - - - - - - Product(s) Price
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help