Drag and drop the conditional expressions to obtain a code which outputs * to the screen. (Note: some code boxes will not be used

DRAG DROP

Drag and drop the conditional expressions to obtain a code which outputs * to the screen. (Note: some code boxes will not be used.)

Answer:

Explanation:

One possible way to drag and drop the conditional expressions to obtain a code which outputs * to the screen is:

if pool > 0:

print("*")

elif pool < 0:

print("**")

else:

print("***")

This code uses the if, elif, and else keywords to create a conditional statement that checks the value of the variable pool. Depending on whether the value is greater than, less than, or equal to zero, the code will print a different pattern of asterisks to the screen. The print function is used to display the output. The code is indented to show the blocks of code that belong to each condition. The code will output * if the value of pool is positive, ** if the value of pool is negative, and *** if the value of pool is zero.

You can find more information about the conditional statements and the print function in Python in the following references:

[Python If … Else]

[Python Print Function]

[Python Basic Syntax]

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments