Answer:
// here is code in C++.
#include <bits/stdc++.h>
using namespace std;
// main function
int main()
{
// variables Declaration and initialization
int no_gallon=16;
int dis=312;
// find the miles per gallon
double mile_gallon=dis/double(no_gallon);
// print the results
cout<<"number of gallons: "<<no_gallon<<endl;
cout<<"distance travel before refueling: "<<dis<<endl;
cout<<"miles per gallon is: "<<mile_gallon<<endl;
return 0;
}
Explanation:
Declare and initialize the number of gallon and distance travel without refueling. Calculate the miles per gallon by dividing distance with number of gallons.Then print the results.
Output:
number of gallons: 16
distance travel before refueling: 312
miles per gallon is: 19.5
In Python, a string is an array of characters, we can access these characters using index operator []. For example, we have a_string = "Hello World" a_string[0] prints the first character in string ('H').
We can also use index operator to make substrings, for example a_string[0:3] will make a substring with first, second, third and fourth character equal to "Hell".
Now to business
my_string = "This is MY string!"
print(my_string[0:7]) # Prints "This is "
print(my_string[0:7:5]) # Prints "T" then prints the sixth character since we start counting at 0 hence prints "Ti" (note that space is also a character).
Hope this helps.
Q1:
1. Go into the bathroom
2. Put toothpaste on the toothbrush
3. Place head of toothbrush on your teeth
4. Revolve in small circles
5. Repeat 4 for all of your teeth
6. Use water to wash away the toothpaste in you mouth
When was the Ming dynasty established?
the 1100s CE
the 1200s CE
the 1300s CE
the 1400s CE