+ 1

Help with Python output

• Output needed: https://code.sololearn.com/cd2smdqDPXIk • This is my attempt. I'm looking for alternative methods to do it: l = "ABCD" for i in l: for j in l: if i == j or i <= j print(i, j)

10th Feb 2020, 7:42 PM
Vasif Afzal
Vasif Afzal - avatar
2 Answers
+ 2
from itertools import combinations_with_replacement as comb for pair in comb("ABCD",2): print(pair)
10th Feb 2020, 11:10 PM
Diego
Diego - avatar
0
That's terrific.. Thank you for your interest.
11th Feb 2020, 3:24 AM
Vasif Afzal
Vasif Afzal - avatar