Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

question 20 what is the output of this program? fruits = mango, banana,…

Question

question 20
what is the output of this program?
fruits = mango, banana, coconut, jackfruit, orange, litchi
for fruit in fruits:
if fruit == coconut:
continue
print(fruit, end= )

Explanation:

Step1: Understand the loop and condition

The program iterates over the fruits list. When fruit == 'Coconut', the continue statement skips the print statement for that iteration.

Step2: Iterate through each element

  • For 'Mango': fruit != 'Coconut', so print('Mango', end=" ") is executed.
  • For 'Banana': fruit != 'Coconut', so print('Banana', end=" ") is executed.
  • For 'Coconut': fruit == 'Coconut', so continue skips the print statement.
  • For 'Jackfruit': fruit != 'Coconut', so print('Jackfruit', end=" ") is executed.
  • For 'Orange': fruit != 'Coconut', so print('Orange', end=" ") is executed.
  • For 'Litchi': fruit != 'Coconut', so print('Litchi', end=" ") is executed.

Answer:

Mango Banana Jackfruit Orange Litchi