Coding Practice¶
Fix the function below so that it returns how many even numbers are in nums
.
Select the Parsonsprob tab for hints for the construction of the code.
Fix the function below so that it returns how many even numbers are in nums
.
Use the lines to construct the code, then go back to complete the Activecode tab.
Someone could have COVID-19 if their temperature is above 99.9 degrees Fahrenheit. Finish the code below so that it counts and prints how many students in the class may have been exposed. Select the Parsonsprob tab for hints for the construction of the code.
Someone could have COVID-19 if their temperature is above 99.9 degrees Fahrenheit. Finish the code below so that it counts and prints how many students in the class may have been exposed. Use the lines to construct the code, then go back to complete the Activecode tab.
Write the function endsEven
that takes a vector and removes elements from the end of the vector until
it ends with an even number. Select the Parsonsprob tab for hints for the construction of the code.
Write the function endsEven
that takes a vector and removes elements from the end of the vector until
it ends with an even number. Use the lines to construct the code, then go back to complete the Activecode tab.
Write the function randomNums
that takes two integers: num
which is the number of random numbers
you wish to generate, and max
, which is the maximum value of random number you wish to generate. Your
function should return a vector of num
integers that are between 1 and max
, inclusive.
Select the Parsonsprob tab for hints for the construction of the code.
Write the function randomNums
that takes two integers: num
which is the number of random numbers
you wish to generate, and max
, which is the maximum value of random number you wish to generate. Your
function should return a vector of num
integers that are between 1 and max
, inclusive.
Use the lines to construct the code, then go back to complete the Activecode tab.
Before you keep reading...
Making great stuff takes time and $$. If you appreciate the book you are reading now and want to keep quality materials free for other students please consider a donation to Runestone Academy. We ask that you consider a $10 donation, but if you can give more thats great, if $10 is too much for your budget we would be happy with whatever you can afford as a show of support.
Write the function hundyBundy
that returns a count of all numbers in the passed vector
vec
that are divisible by 100. Select the Parsonsprob tab for hints for the construction of the code.
Write the function hundyBundy
that returns a count of all numbers in the passed vector
vec
that are divisible by 100. Use the lines to construct the code, then go back to complete the Activecode tab.
Write the function weird_print
that prints the first half of a vector of integers in reverse order
and then prints the second half in the order present in the vector.
If we had vec = {1,2,3,4,5,6}
we would print 3 2 1 4 5 6
.
You can assume the size of the vector will always be even.
Select the Parsonsprob tab for hints for the construction of the code.
Write the function weird_print
that prints the first half of a vector of integers in reverse order
and then prints the second half in the order present in the vector.
If we had vec = {1,2,3,4,5,6}
we would print 3 2 1 4 5 6
.
You can assume the size of the vector will always be even.
Use the lines to construct the code, then go back to complete the Activecode tab.