Ask Question
Yesterday, 03:12

for number in range (1,51) : if number % 3 = = 0 and number % 5 = = 0: print ('XY') elif number % 5 = = 0: print ('X') elif number % 3 = = 0: print ('Y')

+4
Answers (1)
  1. Yesterday, 05:14
    0
    Output of the given code is:

    Y

    X

    Y

    Y

    X

    Y

    XY

    Y

    X

    Y

    Y

    X

    Y

    XY

    Y

    X

    Y

    Y

    X

    Y

    XY

    Y

    X

    Explanation:

    In the for loop variable "number" will iterate from 1 to 150 (inclusive).

    in the "if" condition it is checking that the number is divisible by 3 and 5 both if the number is divisible by both 3 & 5 then it will print XY as output.

    In the first "elif", if the number is divisible by 5 only then it will print X

    as output. And in the last "elif", if number is divisible by 3 only then it will

    print Y as output. Nothing will be printed if all three conditions are FALSE.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “for number in range (1,51) : if number % 3 = = 0 and number % 5 = = 0: print ('XY') elif number % 5 = = 0: print ('X') elif number % 3 = = ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers