Assume that a boolean variable isQuadrilateral has been declared, and that another variable, numberOfSides has been declared and initialized. Write a statement that assigns the value true if numberOfSides is exactly 4 and false otherwise.

Respuesta :

Answer:

# The below code is in python programming language.

if(numberOfSides==4): #check the value number of slide is equal to 4 or not.

   isQuadrilateral=True # assignment statement for if condition

else:

  isQuadrilateral=False # assignment statement for else condition

Explanation:

The above code is in python language in which--

  • The first lines are the "if" condition which checks the value of "numberofslides" variable.
  • The second lines assign true in "isQuadrilateral" variable if "if" condition is true.
  • The third line is for "else" statement that executes when the "if" condition is false.
  • The fourth line is for "else" statement which assigns the value false to the numberofslides variables.
ACCESS MORE