write an if statement that assigns deliverycomplete with 1 if bricksdelivered is equal to bricksexpected.\

Sagot :

Using the knowledge in computational language in python it is possible to write a code that write an if statement that assigns deliverycomplete with 1 if bricksdelivered is equal to bricksexpected.

Writting the code:

%Define the function CheckDelivery()

function deliveryComplete = CheckDelivery( brickDelivered, bricksExpected)

%Start the if-else statements to check if delievery is completed.

%Delievery completed

if ( brickDelivered == bricksExpected)

deliveryComplete = 1;

%Delievery not completed.

else

deliveryComplete = 0;

%End of if-else

end

%Print the result.

fprintf("deliveryComplete: %d\n",deliveryComplete);

%End of the function.

end

%demo.m

%Call the function for the output 0.

CheckDelivery(10,11);

%Call the function for the output 1.

CheckDelivery(10,10);

function deliveryComplete = CheckDelivery(bricksDelivered, bricksExpected)

   deliveryComplete = 0;

   if bricksDelivered == bricksExpected

       deliveryComplete = 1;

   end

end

See more about python at brainly.com/question/18502436

#SPJ1

View image Lhmarianateixeira