1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Nikolay [14]
3 years ago
13

company gives the following discount if you purchase a large amount of supply. Units Bought Discount 10 - 19 20% 20 - 49 30% 50

- 99 35% 100 40% If each item is $4.10. Create a program that asks the user how many items they want to buy, then calculates the pre-discount price, the amount of discount and the after discount price. So for example if order 101 items, I should see something similar to the following: With your order of 101 items, the total value will be $414.10 with a discount of $165.64 for a final price of $248.46. Your output should be very well organized, and use the correct formatting. (Including precision)
Computers and Technology
1 answer:
ratelena [41]3 years ago
3 0

Answer:

In Python:

order = int(input("Order: "))

discount = 0

if(order >= 10 and order <20):

    discount = 0.20

elif(order >= 20 and order <50):

    discount = 0.30

elif(order >= 50 and order <100):

    discount = 0.35

elif(order >= 100):

    discount = 0.40

price = order * 4.1

discount = discount * price

print("With your order of "+str(order)+" items, the total value will be $"+str(round(price,2))+" with a discount of $"+str(round(discount,2))+" for a final price of $"+str(round((price-discount),2)))

Explanation:

This prompts the user for number of orders

order = int(input("Order: "))

This initializes the discount to 0

discount = 0

For orders between 10 and 19 (inclusive)

if(order >= 10 and order <20):

-----------discount is 20%

    discount = 0.20

For orders between 20 and 49 (inclusive)

elif(order >= 20 and order <50):

-----------discount is 30%

    discount = 0.30

For orders between 50 and 99 (inclusive)

elif(order >= 50 and order <100):

-----------discount is 35%

    discount = 0.35

For orders greater than 99

elif(order >= 100):

-----------discount is 40%

    discount = 0.40

This calculates the total price

price = order * 4.1

This calculates the pre discount

discount = discount * price

This prints the report

print("With your order of "+str(order)+" items, the total value will be $"+str(round(price,2))+" with a discount of $"+str(round(discount,2))+" for a final price of $"+str(round((price-discount),2)))

You might be interested in
If you want to design computing components for cars and medical
Marysya12 [62]

Computer engineering is the course you have to study if you want to design computing components for cars and medical equipment.

<h3>What Is Computer Engineering?</h3>

Computer Engineering is known to be one filed that is made up of the fields of electrical engineering and also that of computer science to form new kind of system hardware or software.

Based on the above, Computer engineering is the course you have to study if you want to design computing components for cars and medical equipment.

Learn more about Computer engineering from

brainly.com/question/24181398

#SPJ1

4 0
2 years ago
Pick the 3 correct Python functions that parse and output only the date and time part of each log in log.txt as follows.
Mila [183]

Answer:

1, 4, 5

Explanation:

parse2:

. In this case it's passing "r" as an argument, which really does absolutely nothing, because whenever you call open("file.txt") it defaults to reading mode, so all you're doing is explicitly passing the "r". So let's look at the first line. Whenever you call str.split() without any arguments, by default it splits it by empty text, and filters any empty text. So str.split() is not the same as str.split(" ") although it has similar behavior. "     ".split(" ") will output ['', '', '', '', '', ''], while "     ".split() will output []. So in this case the line.split() will split the string '10.1.2.1 - car [01/Mar/2022:13:05:05  +0900] "GET /python HTTP/1.0" 200 2222' into the list<em> ['10.1.2.1', '-', 'car', '[01/Mar/2022:13:05:05', '+0900]', '"GET', '/python', 'HTTP/1.0"', '200', '2222'].</em> As you can see the the data is split into two pieces of text, AND they include the brackets in both strings. So when it gets the 3 index and strips it of the "[]" it will have the incomplete date

parse3:

 In this instance the "r" does nothing as mentioned before the "r" is already defaulted whenever you call open("file.txt") so open("file.txt") is the same as open("file.txt", "r"). So in this case we won't be working left to right, we're going inside the brackets first, kind of like in math you don't don't work left to right in equation 3 + 3(2+3). You work in the brackets first (inside brackets you do left to right). So the first piece of code to run is the line.split("[" or "]"). I actually kind of misspoke here. Technically the "[" or "]" runs first because this doesn't do what you may think it does. The or will only return one value. this is not splitting the line by both "[" and "]". The, or will evaluate which is true from left to right, and if it is true, it returns that. Since strings are evaluated on their length to determine if they're true. the "[" will evaluate to true, because any string that is not empty is true, if a string is empty it's false. So the "[" will evaluate to true this the "[" or "]" will evaluate to "[". So after that the code will run line.split("[") which makes the list: <em>['10.1.2.1 - car ', '01/Mar/2022:13:05:05  +0900] "GET /python HTTP/1.0" 200 2222']</em>. Now the [3:5] will splice the list so that it returns a list with the elements at index 3 (including 3) to 5 (excluding 5). This returns the list: [], because the previous list only has 2 elements. There are no elements at index 3 to 5 (excluding 5). So when you join the list by " ", you'll get an empty string

parse4:

  So I'm actually a bit confused here, I thought the "r+" would open the file in read-writing mode, but maybe this is a different version of python I have no idea, so I'm going to assume it is reading/writing mode, which just means you can read and write to the file. Anyways when you split the line by doing line.split(), as mentioned before it will split by empty spaces and filter any empty spaces. This line will return: <em>['10.1.2.1', '-', 'car', '[01/Mar/2022:13:05:05', '+0900]', '"GET', '/python', 'HTTP/1.0"', '200', '2222']</em>. and then you splice the list from indexes 3 to 5 (excluding 5). This will return the list: <em>['[01/Mar/2022:13:05:05', '+0900]']</em> which has the two pieces of information you need for the date. Now it joins them by a space which will output: '[01/Mar/2022:13:05:05 +0900]'. Now when you strip the "[]" you get the string: '01/Mar/2022:13:05:05 +0900' which is the correct output!

parse 5:

 So in this example it's using re.split. And the re.split is splitting by "[" or "]" which is what re.split can be used for, to split by multiple strings, which may be confused by string.split("[" or "]") which is not the same thing as explained above what the latter does. Also the reason there is a backslash in front of the [ and ] is to escape it, because normally those two characters would be used to define a set, but by using a \ in front of it, you're essentially telling regex to interpret it literally. So in splitting the string by "[" and "]" you'll get the list: <em>['10.1.2.1 - car ', '01/Mar/2022:13:05:05  +0900', ' "GET /python HTTP/1.0" 200 2222']</em> which has 3 elements, since it was split by the [ and the ]. The second element has the date, so all you need to do is index the list using the index 1, which is exactly what the code does

8 0
2 years ago
Pls help... : Slide layouts can be changed by _____.
Eddi Din [679]

Answer:

Selecting a new layout from the task pane

Explanation:

6 0
3 years ago
What type of Windows server has Active Directory installed and is responsible for allowing client computers access to domain res
Basile [38]

Answer:

Domain controller                    

Explanation:

  • A domain controllers is a server which acknowledges authentication requests and validates users access on the computer network in order to use the resources.
  • This is done by the domain controller by verifying the username and password.
  • It also allows user to access the other domain and also access the resources of other domain.
  • For example there is a network of multiple computers and each computer requires authentication i.e user is asked to provide the username and password.
  • Authenticating every computer and managing is not easy so a computer is appointed this task of authentication other computers.
  • This computer  is called domain controller which can easily maintain these authentication details of the users.
  • The authentication information (login details) of users, computers and shared resources is saved in Active Directory database.
  • If a user requests access to the resource via login then the login details (username and password) of the user should match with that stored in the Active Directory in order to grant access to the user.
  • Domain controller enables resources sharing and is good for large networks and provides with improved security.
4 0
3 years ago
The ______ sets rules for both the transport of data packets and the addressing system for a network such as the ARPANET
Phantasy [73]

The tool that sets rules for both the transport of data packets and the addressing system for a network such as the ARPANET is called; Protocol

<h3>Understanding Protocols</h3>

In computer systems communications, a protocol is defined as a set of rules and regulations that allow a network of nodes to transport and receive data information.

Now, each transport layer in a system of network such as ARAPNET will always have a protocol set such as TCP and IP.

Read more about internet protocols at; brainly.com/question/17820678

3 0
2 years ago
Other questions:
  • I need help please <br> just plug in the words with their definitions.......
    10·2 answers
  • Write a program that reads a file containing text. Read each line and send it to the output file, preceded by line numbers. If t
    8·1 answer
  • When a piston has three rings, the bottom ring will be?
    9·1 answer
  • nside of your organization that checks how often client machines access it. If a client machine hasn't accessed the server in th
    6·1 answer
  • You want to print only the fourth page of your research document. What would you do?
    9·2 answers
  • Write two scnr.nextInt statements to get input values into birthMonth and birthYear. Then write a statement to output the month,
    10·1 answer
  • Who watches Riverdale ? if you do can we be friends(pLEASE DON'T DELETE) and also who is your fav character from Riverdale
    8·2 answers
  • Your computer science teacher asks you to sample a black and white image that is 4” x 6”. How would you sample the image to prov
    10·1 answer
  • How much money did Uta initially invest?$180.00$320.00$352.48$471.70
    14·1 answer
  • In your aws vpc, you need to add a new subnet that will allow you to host a total of 20 ec2 instances. which ipv4 cidr block wou
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!