intro to computer programming

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. Your program should use a loop to ask the user how many orders they need to process and continue processing orders as long as the number of orders is greater than 0.

1. 👍 0
2. 👎 0
3. 👁 1,105
1. #!/usr/bin/python3

def main():
packages = int(input('Enter the number of packages you would like to order: '))

if packages <= 19 and packages >= 10:
discount(packages, .2)
elif packages <= 49 and packages >= 20:
discount(packages, .3)
elif packages <= 99 and packages >= 50:
discount(packages, .4)
else:
discount(packages, .5)

def discount(value, x):
print('You receive a %d discount' % x)
total = reg * value * x
print('\$', total)

reg = 99
main()
not finished just to give you right idea

1. 👍 1
2. 👎 0

Similar Questions

1. Programming

Write a pseudocode to represent the logic of a program that allows a user to enter an hourly pay rate and hours worked. The program outputs the user's gross pay

2. Programming

Draw a flowchart or write pseudo code to represent the logic of a program that allows the user to enter values for the current year and the user’s birth year. The program outputs the age of the user this year. Preferably a

3. java programming

1. Time Calculator Write a program that asks the user to enter a number of seconds. • There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the

4. Pseudocode

Write an algorithm and pseudocode that represents a program that allows a user to enter two numbers. Your program should calculate the sum, difference (both directions), product, and quotient (both directions) of the two numbers.

1. C++

// Program: name of program // Author: your name // Date Written: date you began writing the program /* Abstract: Brief description of the program */ Include in-line comments in the body of your program. You can convert

2. web technology

write a javascript program that ask the user to enter up to 10 scores golf

3. CIS

Draw a flowchart or write pseudocode to represent the logic of a program that allows the user to enter a value. The program multiplies the value by 10 and outputs the result.

4. computer science

I need help with my Java homework! Write a program that calculates a customer's monthly bill. It should ask the user to enter the letter of the package the customer has purchased (A, B, or C) and the number of hours that were

1. Programming and Design

Draw the hierarchy chart and design the logic for a program that calculates the projected cost of an automobile trip. Assume that the user's car travels 20 miles per gallon of gas. Design a program that prompts the user for a

2. programming

Write a program that plays a simple dice game between the computer and the user. It uses an unusual dice that has 12 sides, with numbers that start from 10. When the program runs, a loop should repeat 5 times. Each iteration of

3. Computer Programing & Logic Design

Submit pseudocode and a flowchart for the following programming exercise: Test Average and Grade Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the

4. programming

Write a program which allows user to enter 10 student names and scores for Java programming 1 and Java programming 2. Allow user to choose which course they want to enter the record for. Use the loop to ask input from user. The