Answer:
miles_gallon = float(input("Enter car's miles/gallon: "))
dollars_gallon = float(input("Enter gas dollars/gallon: "))
print("Gas cost for 20 miles is $", (20 / miles_gallon) * dollars_gallon)
print("Gas cost for 75 miles is $", (75 / miles_gallon) * dollars_gallon)
print("Gas cost for 500 miles is $", (500 / miles_gallon) * dollars_gallon)
Explanation:
*The code is in Python.
Ask the user to enter the car's miles/gallon and gas dollars/gallon
Calculate the gas cost for 20 miles, divide 20 by miles_gallon and multiply the result by dollars_gallon, then print it
Calculate the gas cost for 75 miles, divide 75 by miles_gallon and multiply the result by dollars_gallon, then print it
Calculate the gas cost for 500 miles, divide 500 by miles_gallon and multiply the result by dollars_gallon, then print it
Answer:
The solution code is written in Python 3
- count = 0
- sum = 0
-
- num = input("Enter a number: ")
-
- while(num != ''):
- sum += float(num)
- count += 1
- num = input("Enter a number: ")
-
- print("Sum : " + str(sum))
- print("Average: " + str(sum / count))
Explanation:
Firstly, we declare two variables count and sum to hold the number of input number and the total of the input number, respectively (Line 1-2)
Next, we prompt user to input the first number (Line 4). While the num is not ' ' (This means it is not "Enter" key), accumulate the num to sum variable and increment count by one (Line 6-8) and then prompt the user to input the next number (Line 9).
At the end, display the sum and average using print function (Line 11 -12).
After you use the create sequence statement to create a sequence, you can use the NEXTVAL pseudo column to get the next value in the sequence.
<h3 /><h3>How do you create a sequence?</h3>
- You must have the Create any sequence system privilege to create a sequence in another user's schema.
- Specify the schema that will hold the sequence.
- If you leave out schema, Oracle Database will create the sequence in your own schema. Name the sequence that will be created.
- Pseudo-columns allow selection, but you cannot edit, update, or remove their values.
- A pseudo-column is analogous to a function that does not accept any inputs. This section goes over the two pseudo-columns, CURRVAL and NEXTVAL.
- A pseudo column is a "column" that displays a value when a value is selected but is not one of the table's true columns.
- Two examples are SysDate and RowID. It is frequently used in tandem with the DUAL table.
- After you utilize the make sequence statement to make a sequence, you can utilize the NEXTVAL pseudo column to obtain the next value in the sequence.
To learn more about NEXTVAL, refer to:
brainly.com/question/13043887
#SPJ4