How to print this sequence using python loops | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to print this sequence using python loops

2*4= 8 2 * 6 = 12 4 * 2 = 8 4 * 6 = 24 6*2= 12 6*4 = 24

10th Apr 2023, 6:00 AM
Ayush Pandit
1 Answer
+ 6
You can solve it with two nested loops. Each loop would have a variable (a and b) that takes the numbers 2, 4 and 6. You can express it with range(2,7,2) When a and b are not equal, do the printing of their multiplication. Otherwise do nothing.
10th Apr 2023, 6:15 AM
Tibor Santa
Tibor Santa - avatar