Computer Science, asked by nadeem3261, 4 months ago

Write a program which shows the following as output:
1 1 1
1 1 2
1 2 1
1 2 2
2 1 1
2 1 2
2 2 1
2 2 2

Answers

Answered by allysia
1

Answer:

Here you go,

\\\tt for\ i\ in\ range(100,223): \\\tt{\qquad  b=list(str(i)) }\\{\qquad count1=b.count("1")}\\{\qquad count2=b.count("2")}\\{\qquad sum= count1+count2}\\{\qquad if\ "1"\ in\ b\ and\ "2"\ in\ b\ and\ sum==3:}\\{\qquad {\qquad print(i) }}

Attachment for satisfaction :) .

Attachments:
Similar questions