A201 Introduction to Programming 1

A201 Homework 3

Due Date: Tuesday, September 12, 2023.

Goal: to use conditionals in Python.

Make sure to complete Lab 3 before doing the homework.

Create a Python script file called hw3.py. Add your name at the top as a comment, along with the class name and date. Both exercises should be in this file, with a comment before each of them to mark it.

Ex. 1. The largest number

Write a program that asks the user for three numbers, then outputs the largest of these numbers.

Hint: you need either multiple (nested) conditionals, or one conditional and conditions involving a logical operator.

Ex. 2. Shipping cost

Write a program that determines the shipping cost for a purchase from an online company. Suppose that the shipping rates are the following, based on the total price of the purchase:

The program should start by asking the user for the amount of the total, input it in a variable, compute the shipping cost, then output the result.

Homework Submission

Upload the files lab3.py and hw3.py in Canvas, Assignments, Homework 3.