Python Forum
Working with lists homework (2)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Working with lists homework (2)
#1
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!
Reply
#2
What have you tried?
Where do you need help?
Reply
#3
As well as make a more descriptive title next time
Recommended Tutorials:
Reply
#4
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
Reply
#5
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
Reply
#6
I think it is not solved. He asked the same question in the mailing list.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#7
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
Recommended Tutorials:
Reply
#8
(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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Homework on addition with working paperplanexx 1 2,483 Aug-19-2018, 12:40 PM
Last Post: j.crater
  Working with lists homework Otaku2 7 5,054 Jun-06-2018, 03:40 AM
Last Post: hf8bm
  Lists Homework kekev1997 1 2,579 Nov-19-2017, 03:07 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020