help me ?

Andre Müller gbs.deadeye at gmail.com
Tue Feb 27 16:50:14 EST 2018


Hello,

it's a duplicate:
https://python-forum.io/Thread-Working-with-lists-homework-2

I have seen this more than one time. We don't like it. You keep people busy
with one question at different places.

You need two lists and one empty list. One outer loop iterating over the
first list and one inner loop iterating over the second list. In the inner
loop you concatenate the two elements from the outer-loop and inner-loop.
Then you append them to the empty list. This text is 10 times longer as the
source code...

Complicated solution:

from string import ascii_lowercase as letter
list1 = [str(i) + c for i in range(1,4) for c in letter[:3]]
list2 = [c[::-1] for c in list1]

But this won't help you. Before you understand the code above, you have to
understand for-loops and nested for-loops. Then you can proceed with list
comprehensions. But I don't see that your intention is to learn and
understand Python. You just want to finish your homework, which bother you.

Greetings
Andre



More information about the Python-list mailing list