PYTHON PROGRAMMING a) Create a dictionary, gasPrice, and initialize it with the following data: 'Hess': 2.03 'BP': 2.65 'Speedy': 2.11 'Quick Check': 1.97 'Amoco': 2.31 b) Use a loop to print all items of the dictionary gasPrice as follows: name gas price today is overpriced (if the value is 2.50 or above). name gas price today is expensive (if the value is 2.30 or above). name gas price today is fair (if the value is 2.00 or above). name gas price today is cheap (if the value is below 2.00). Make sure to precisely match the output format below. Example Output Hess gas price today is fair. BP gas price today is overpriced. Speedy gas price today is fair. Quick Check gas price today is cheap. Amoco gas price today is expensive.
PYTHON
a) Create a dictionary, gasPrice, and initialize it with the following data:
'Hess': 2.03
'BP': 2.65
'Speedy': 2.11
'Quick Check': 1.97
'Amoco': 2.31
b) Use a loop to print all items of the dictionary gasPrice as follows:
name gas price today is overpriced (if the value is 2.50 or above).
name gas price today is expensive (if the value is 2.30 or above).
name gas price today is fair (if the value is 2.00 or above).
name gas price today is cheap (if the value is below 2.00).
Make sure to precisely match the output format below.
Example Output
Hess gas price today is fair.
BP gas price today is overpriced.
Speedy gas price today is fair.
Quick Check gas price today is cheap.
Amoco gas price today is expensive.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images