62.4k views
4 votes
Find the maximum value and minimum value in milestracker. Assign the maximum value to maxmiles, and the minimum value to minmiles.

1 Answer

6 votes

Python:

#TODO: Update the milestracker as you wish.

milestracker = [3,4,5,6,7,8,9,10,11]

#Find max and min and then print those values.

maxmiles = max(milestracker)

minmiles = min(milestracker)

print("The maximum:",maxmiles,"\\The minimum:",minmiles)

C++:

#include <bits/stdc++.h>

int main(int argc, char* argv[]) {

//TODO: Update the milestracker as you wish.

std::vector<int> milestracker{2,3,4,5,6,7,8,91,10,11};

//Compare and then print.

int maxmiles = *std::max_element(milestracker.begin(),milestracker.end());

int minmiles = *std::min_element(milestracker.begin(),milestracker.end());

std::cout << "The maximum: " << maxmiles << "\\The minimum: " << minmiles << std::endl;

return 0;

}

User Smonusbonus
by
8.4k points