- Create a word processing file that contains your answers to the following Algorithm Workbench questions:
From Chapter 3 on pages 150 and 151, Questions 2 and 7 (20 points)
From Chapter 4 on page 203, Questions 2, 3, and 4 (30 points)
Name this file “XYLab2“, where “X” and “Y” are your first and last initials.
- Create a Text file with a “.py” file extension that contains your proposed solution to Programming Exercise 12, Software Sales, at the end of Chapter 3 on page 154. (50 points)
Name this file “XYLab2.py“, where “X” and “Y” are your first and last initials.
Chapter 3 question 2
Write an if statement that assigns 0 to the variable b, and assigns 1 to the variable c if the variable a is less than 10.
Chapter 3 question 7
Write an if-else statement that determines whether the points variable is outside the range of 9 to 51. If the variable’s value is outside this range it should display “Invalid points.” Otherwise, it should display “Valid points.”
Chapter 4 question 2
Write a while loop that asks the user to enter two numbers. The numbers should be added and the sum displayed. The loop should ask the user if he or she wishes to perform the operation again. If so, the loop should repeat, otherwise it should terminate.
Chapter 4 question 3
Write a for loop that displays the following set of numbers: 0, 10, 20, 30, 40, 50 . . . 1000
Chapter 4 question 4
Write a loop that asks the user to enter a number. The loop should iterate 10 times and keep a running total of the numbers entered.
Programming exercise with .py extension.
A software company sells a package that retails for $99. Quantity discounts are given according to the following table:
Write a program that asks the user to enter the number of packages purchased. The program should then display the amount of the discount (if any) and the total amount of the purchase after the discount.