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
Troyanec [42]
3 years ago
9

Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the ga

s cost for 20 miles, 75 miles, and 500 miles.
Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
print('{:.2f} {:.2f} {:.2f}'.format(your_value1, your_value2, your_value3))

Ex: If the input is:

20.0
3.1599
Then the output is:

3.16 11.85 79.00
Computers and Technology
2 answers:
Katen [24]3 years ago
8 0

Answer:

# Program in Python

# Take miles/gallon as input from user

miles_per_gallon = float(input('Please enter cars miles/gallon: '))

# Take dollars/gallon as input from user

dollars_per_gallon = float(input('Please enter gas dollars/gallon: '))

# Formula for calculating gas cost

dollars_per_mile = dollars_per_gallon/miles_per_gallon

# Gas cost for 20 miles

your_value1 = 20 * dollars_per_mile

# Gas cost for 75 miles

your_value2 = 75 * dollars_per_mile

# Gas cost for 500 miles

your_value3 = 500 * dollars_per_mile

# Display the results as output

print('{:.2f} {:.2f} {:.2f}'.format(your_value1, your_value2, your_value3))

Explanation:

First of all take miles/gallon and dollars/gallon as input from user  and store them in their respective variables. Then calculate the gas cost by dividing dollars/gallon with miles/gallon. Multiply this calculated cost with 20, 75 and 500 respectively. Finally display the results by using print statement.

Output:

Please enter cars miles/gallon: 20.0

Please enter gas dollars/gallon: 3.1599

3.16 11.85 79.00

hram777 [196]3 years ago
8 0

Answer:

def driving_cost(driven_miles, miles_per_gallon, dollars_per_gallon):

  gallon_used = driven_miles / miles_per_gallon

  cost = gallon_used * dollars_per_gallon  

  return cost  

miles_per_gallon = float(input(""))

dollars_per_gallon = float(input(""))

cost1 = driving_cost(10, miles_per_gallon, dollars_per_gallon)

cost2 = driving_cost(50, miles_per_gallon, dollars_per_gallon)

cost3 = driving_cost(400, miles_per_gallon, dollars_per_gallon)

print("%.2f" % cost1)

print("%.2f" % cost2)

print("%.2f" % cost3)

Explanation:

You might be interested in
You typed the word "weather" when you meant to type the word "whether. " When will Writer or Word flag this as a misspelling or
Alenkasestr [34]

The word flag shows misspelling while typing word "weather" instead of "whether"  is depends on the rest of the sentence and how you have your settings for grammar and spell checker.

<h3>What is word flag or spell checker?</h3>

Word flag or spell checker is the tool or software which helps to identify the misspelling or a grammar problem while typing.

The word "weather"  is typed when there was  to type the word "whether. "

Now, before checking that, when will Writer or Word flag this as a misspelling or a grammar problem, first we have to understand the meaning of both the word.

Word "weather"  is the state of atmosphere for different conditions of temperature, pressure, and humanity. While the word "whether " is the expression of confusion between two things.

The option given for this problem are,

  • Depends on the rest of the sentence and how you have your settings for grammar and spell checker
  • Never
  • All the time.

Word flag, tells the incorrect word, spelling or grammatical error in a sentence.

To identify a particular word which is misplaced in place of another almost similar spelled word, it checks the other word and sentence.

If the particular word does not match with the sentence, the  word flag or spell checker shows the error.

Hence, the word flag shows misspelling while typing word "weather" instead of "whether"  is depends on the rest of the sentence and how you have your settings for grammar and spell checker.

Learn more about the spell checker here;

brainly.com/question/515655

6 0
2 years ago
Which is the highest in complexity?
Scorpion4ik [409]

Answer:

B. (n2) * n.

Explanation:

The highest complexity is (n2)*n because on solving it will come out to be n³.So the growth rate is of cubical order which is the highest among the options.

(n) * 2n is of the order of square.On solving it will be 2n².

n² is also of the order of square.

nlogn complexity is less than n² but greater than n.

3n is of linear complexity.It has the lowest complexity among the options.

6 0
3 years ago
If you want to tune into a radio station that is carried by a signal with wavelength 3.0 meters, what channel would you choose?
Over [174]

Answer:  The radio should be tuned to 100. 0 Mhz.

Explanation:

As radio waves are electromagnetic waves, like x-rays, UV rays, and all the wavelengths of visible light, they propagate in the free space at the speed of light: 3. 10⁸ m/s.

At any wave, there is a fixed relationship between the distance travelled by the wave along one cycle (which is called wavelength ) and the speed at which the wave oscillates (which is called the frequency of the wave), with the speed at which the wave propagates, as follows:

λ (wavelength) =  v (speed) / f (frequency)

Replacing by the values, and solving for frequency, we have:

f = 3. 10⁸ m/seg / 3 m = 10⁸ 1/sec = 10⁸ Hz = 100. 0 Mhz

This is the radio channel to which must be tuned in order to listen the station with a wavelength of 3 m, in the FM band.

6 0
4 years ago
ANSWER QUICKLY!!
Alina [70]

Answer: I did some research I narrowed it down to page link and page break so I think it might be page link but look up page break and you will see what I think it might be that ok hope this helps.

8 0
2 years ago
The OSI security architecture provides a systematic framework for defining security attacks, mechanisms, and services. True or F
Alex Ar [27]

Answer:

True is the correct answer for the above question

Explanation:

  • The OSI security architecture is a security framework that is used to secure the data packets when it is going to transfer on the internet for communication.
  • It is used to define the security rules and mechanism which need to secure the data packets.
  • It mainly focuses on Security services, Security attacks, Security mechanisms.
  • The above question-statement states about the framework which defines the security mechanism to secure from the attacks are known as OSI Security architecture which is the correct statement which is described above. Hence True is the correct answer.
3 0
4 years ago
Other questions:
  • Which command would you use to move a file from one location to another?
    6·2 answers
  • Tags that provide browsers with information about document characteristics
    15·1 answer
  • Without protocols the information sent and received through the Internet would never reach its intended target and even if it di
    6·1 answer
  • Which of the following are personal video journal entries posted on the web? Select one: A. Podcasts B. Vlogs C. Blogs D. Newsgr
    14·1 answer
  • Chris needs to create a simple web page with HTML. Which tool will he use? HyperText Web browser Text editor Operating software
    10·1 answer
  • 7x+ 2x = 14<br>want is (x)?​
    15·1 answer
  • Google is an example of a(n):
    13·1 answer
  • The ________ is the part of the nail plate that extends beyond the nail bed.
    8·2 answers
  • Learning how to use word processing and spreadsheets, and creating presentations are all considered __________ computer skills.
    15·2 answers
  • PHP server scripts are surrounded by delimiters, which? *
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!