QUESTION IMAGE
Question
arrastra y suelta las expresiones condicionales para obtener un código que imprima *** en la consola (nota: no se utilizarán todas las cajas de código.)
height = 64 // 2
if height > 0:
print(\**\)
elif :
print(\****\)
elif :
print(\*****\)
To solve this, we analyze the code structure and the conditional expressions:
Step 1: Analyze the first elif
The first print (inside if height > 0) outputs . The next print outputs , so we need a condition where height is equal to some value (or in a range) that triggers . Looking at the initial calculation height = 84 // 2 = 42 (wait, no—wait, 84 // 2 is 42? Wait, maybe a typo, but the key is the conditions. Wait, the first if is height > 0, then elif for height == 0? No, wait, the output for the second print is *, so maybe the condition is height == 0? No, let's re-examine.
Wait, the code starts with height = 84 // 2 (which is 42). Then if height > 0: print(""). Then elif [condition]: print(""), then elif [condition]: print("***").
Wait, maybe the intended logic is:
- If
height > 0, print** - If
height == 0, print***(no, that doesn't make sense). Wait, maybe the conditions are about the value ofheightrelative to 0. Wait, the left side hasheight < 0,height > 0,height == 0,height <= 0.
Wait, the first if is height > 0, so the next elif should be a condition that is mutually exclusive. Let's think:
if height > 0→ print**elif height == 0→ print***elif height < 0→ print****
But let's check the left-side options. The left has height < 0, height > 0 (used in if), height == 0, height <= 0.
Wait, maybe the first elif is height == 0 (to print ), and the second elif is height < 0 (to print *).
So:
- First
elif(forprint("***")):height == 0 - Second
elif(forprint("****")):height < 0
But let's confirm. The initial height = 84 // 2 = 42, so height > 0 is true, so it would print **. But maybe the problem has a different setup. Alternatively, maybe the height calculation is height = 84 // 2 (42), but the conditions are about height relative to 0.
Wait, perhaps the correct conditions are:
elif height == 0:→ print***elif height < 0:→ print****
So the first elif (for ) uses height == 0, and the second elif (for *) uses height < 0.
But let's check the left-side options. The left has:
height < 0height > 0(used inif)height == 0height <= 0
So:
- First
elif(print***):height == 0 - Second
elif(print****):height < 0
Thus, the first elif box (for print("")) should have height == 0, and the second elif box (for print("*")) should have height < 0.
But let's verify the code flow:
height = 84 // 2→ 42 (soheight > 0is true, soprint("")runs. Then theelifconditions are checked, but sinceheight > 0is true, theelifs are skipped. But ifheightwere 0,elif height == 0would run and print. Ifheightwere negative,elif height < 0would run and print***.
So the correct drag-and-drop is:
- First
elif(print***):height == 0 - Second
elif(print****):height < 0
(Note: The initial height = 84 // 2 is 42, so the if condition height > 0 is true, and the elifs are not executed here. But the problem is about arranging the conditions for the code structure.)
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
To solve this, we analyze the code structure and the conditional expressions:
Step 1: Analyze the first elif
The first print (inside if height > 0) outputs . The next print outputs , so we need a condition where height is equal to some value (or in a range) that triggers . Looking at the initial calculation height = 84 // 2 = 42 (wait, no—wait, 84 // 2 is 42? Wait, maybe a typo, but the key is the conditions. Wait, the first if is height > 0, then elif for height == 0? No, wait, the output for the second print is *, so maybe the condition is height == 0? No, let's re-examine.
Wait, the code starts with height = 84 // 2 (which is 42). Then if height > 0: print(""). Then elif [condition]: print(""), then elif [condition]: print("***").
Wait, maybe the intended logic is:
- If
height > 0, print** - If
height == 0, print***(no, that doesn't make sense). Wait, maybe the conditions are about the value ofheightrelative to 0. Wait, the left side hasheight < 0,height > 0,height == 0,height <= 0.
Wait, the first if is height > 0, so the next elif should be a condition that is mutually exclusive. Let's think:
if height > 0→ print**elif height == 0→ print***elif height < 0→ print****
But let's check the left-side options. The left has height < 0, height > 0 (used in if), height == 0, height <= 0.
Wait, maybe the first elif is height == 0 (to print ), and the second elif is height < 0 (to print *).
So:
- First
elif(forprint("***")):height == 0 - Second
elif(forprint("****")):height < 0
But let's confirm. The initial height = 84 // 2 = 42, so height > 0 is true, so it would print **. But maybe the problem has a different setup. Alternatively, maybe the height calculation is height = 84 // 2 (42), but the conditions are about height relative to 0.
Wait, perhaps the correct conditions are:
elif height == 0:→ print***elif height < 0:→ print****
So the first elif (for ) uses height == 0, and the second elif (for *) uses height < 0.
But let's check the left-side options. The left has:
height < 0height > 0(used inif)height == 0height <= 0
So:
- First
elif(print***):height == 0 - Second
elif(print****):height < 0
Thus, the first elif box (for print("")) should have height == 0, and the second elif box (for print("*")) should have height < 0.
But let's verify the code flow:
height = 84 // 2→ 42 (soheight > 0is true, soprint("")runs. Then theelifconditions are checked, but sinceheight > 0is true, theelifs are skipped. But ifheightwere 0,elif height == 0would run and print. Ifheightwere negative,elif height < 0would run and print***.
So the correct drag-and-drop is:
- First
elif(print***):height == 0 - Second
elif(print****):height < 0
(Note: The initial height = 84 // 2 is 42, so the if condition height > 0 is true, and the elifs are not executed here. But the problem is about arranging the conditions for the code structure.)