A résolu


Number of 1s in the Binary Representation of a Number
*Description* Return the number of 1s in the (unsigned integer) binary representation of a number. This function should be ab...

presque 10 ans il y a

A résolu


Function call in expression: Reduced pricing.
Write a single statement that assigns cartTotal with the discounted cost of items 1 and 2. Function DiscountedPrice will return ...

presque 10 ans il y a

A résolu


Column arrays: Transpose a row array
* Construct a row array countValues with elements 1 to endValue, using the colon operator. * Transpose countValues to result in...

presque 10 ans il y a

A résolu


Constructing column arrays
* Construct a column array elevatorStops with values 2, 4, 5, 9, and 10

presque 10 ans il y a

A résolu


Element-wise division
* Assign row array weightKilo with the corresponding weight in kilograms. Use the following conversion: kg = lb / 2.2

presque 10 ans il y a

A résolu


Linear-spaced points array
* Construct a row array plotPoints with 5 values that are spaced linearly from lowValue to highValue. Ex: If lowValue is 1 and ...

presque 10 ans il y a

A résolu


Back to basics 21 - Matrix replicating
Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix, generate an output matrix that consists o...

presque 10 ans il y a

A résolu


Number of 1s in a binary string
Find the number of 1s in the given binary string. Example. If the input string is '1100101', the output is 4. If the input stri...

presque 10 ans il y a

A résolu


Indexing the last element: Print queue
* Delete the last element of row array printQueue.

presque 10 ans il y a

A résolu


Tree Height
Assign treeHeight with the tree height given the shadow length and angle of elevation. Simple geometry can compute the heigh...

presque 10 ans il y a

A résolu


Arithmetic array operations
* Add x to each element of array temperatureReadings.

presque 10 ans il y a

A résolu


Indexing an array element
* Assign currentStudent with the second element of array testScores. _Reminder: Array indexing starts with 1._

presque 10 ans il y a

A résolu


Back to basics 9 - Indexed References
Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix and row and column, output the index of th...

presque 10 ans il y a

A résolu


give nth decimal place of pi
max 15th place after the decimal point is ok for now

presque 10 ans il y a

A résolu


Function definition: Volume of a pyramid
Define a function CalculatePyramidVolume with inputs baseLength, baseWidth, and pyramidHeight. The function returns pyramidVolum...

presque 10 ans il y a

A résolu


Concatenating arrays
* Assign studentIDs with concatenated row arrays groupA and groupB

presque 10 ans il y a

A résolu


Generate a vector like 1,2,2,3,3,3,4,4,4,4
Generate a vector like 1,2,2,3,3,3,4,4,4,4 So if n = 3, then return [1 2 2 3 3 3] And if n = 5, then return [1 2 2...

presque 10 ans il y a

A résolu


Whether the input is vector?
Given the input x, return 1 if x is vector or else 0.

presque 10 ans il y a

A résolu


Multi-line comments
* Fix the syntax errors.

presque 10 ans il y a

A résolu


Coordinate geometry
Assign pointsDistance with the distance between point (x1, y1) and point (x2, y2). The distance is calculated by: Distance =...

presque 10 ans il y a

A résolu


Make a 1 hot vector
Make a vector of length _N_ that consists of all zeros except at index _k_, where it has the value 1. Example: Input ...

presque 10 ans il y a

A résolu


Find max
Find the maximum value of a given vector or matrix.

presque 10 ans il y a

A résolu


Construct an array
* Construct an row array named observedValues with elements sensorReading1, sensorReading2, and sensorReading3.

presque 10 ans il y a

A résolu


Double colon operator: Counting down
* Construct a row array countValues from startValue to endValue, elements decremented by -2 Ex: If startValue is 10 and end...

presque 10 ans il y a

A résolu


Write an expression
Assigns finalResult with firstSample plus secondSample, squared, then divided by 3. Ex: If firstSample is 18 and secondSample is...

presque 10 ans il y a

A résolu


Population growth
Assign finalPopulation with the population size given an initial population, population growth rate, and number of years. The fi...

presque 10 ans il y a

A résolu


Say something funny
Say something funny, or not. Your solution will be (fully automatically and objectively) scored based on how clever or funny ...

presque 10 ans il y a

A résolu


Declaring a character
* Assign middleInitial with the character T.

presque 10 ans il y a

A résolu


Increment a number, given its digits
Take as input an array of digits (e.g. x = [1 2 3]) and output an array of digits that is that number "incremented" properly, (i...

presque 10 ans il y a

A résolu


Getting the indices from a vector
This is a basic MATLAB operation. It is for instructional purposes. --- You may already know how to <http://www.mathworks....

presque 10 ans il y a

Charger plus