Python Forum
Working with lists homework (2) - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: Working with lists homework (2) (/thread-8552.html)



Working with lists homework (2) - codellino - Feb-25-2018

Define 2 lists. The first one must contain the integer values 1, 2 and 3 and the second one the string values a, b and c. Iterate through both lists to create another list that contains all the combinations of the A and B elements. The final list should look like one of the 2 lists:



[1a, 1b, 1c, 2a, 2b, 2c, 3a, 3b, 3c]
[a1, a2. a3, b1, b2, b3, c1, c2, c3]


Make the final list contain all possible combinations : [1a, a1, 1b, b1, 1c, c1, 2a, a2, 2b, b2, 2c, c2, 3a, a3, 3b, b3, 3c, c3]

Thank you!


RE: Beginner homework please - Larz60+ - Feb-25-2018

What have you tried?
Where do you need help?


RE: Beginner homework please - metulburr - Feb-25-2018

As well as make a more descriptive title next time


RE: Beginner homework please - codellino - Feb-26-2018

Hello, So I just learned how to create lists:

intlist = []
strlist = []

intlist.append(1)
intlist.append(2)
intlist.append(3)

strlist.append('a')
strlist.append('b')
strlist.append('c')
And from here I am stuck. The teacher didn't tell us how to iterate through both lists to create another list that contains all the combinations of the A and B elements.

no need for help I did it


RE: Working with lists homework (2) - glidecode - Feb-26-2018

Quote:no need for help I did it
Did you solve the homework problem or did you change title and tags? Can't really figure that out from your last post


RE: Working with lists homework (2) - DeaD_EyE - Feb-27-2018

I think it is not solved. He asked the same question in the mailing list.


RE: Working with lists homework (2) - metulburr - Feb-28-2018

Changing the title thread does not change the thread ID. Which is how it knows its the same thread that everyone is subscribed to, etc.

Please also report your solution so future coders with the same question can figure it out


RE: Working with lists homework (2) - buran - Feb-28-2018

(Feb-28-2018, 09:56 AM)metulburr Wrote: Please also report your solution so future coders with the same question can figure it out
Currently there is one more thread regarding this same exercise by another member. I think it's too early to share the solution