Python Forum
Creating lists or arrays as the input
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating lists or arrays as the input
#1
I'm fairly new to using python. I would greatly appreciate it if someone could explain exactly what i'm supposed to do here.

Create the following lists or arrays as the input:
A = [1, 2]
B = [3, 4]
I want the following output
1, 3
1, 4
2, 3
2, 4

Shown in the actual program the top part is the input, and the bottom part is the output.

The question is what kind of loop or series of loops will produce this kind of output?  

Notice how the left side (1, and 2) are different than the right side (3, 4 then 3, 4)
Reply
#2
It's clear enough. What exactly you do not understand?
You have an input and have to produce a specific output. Start with the input as a first step. Show us what you are trying to do=
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#3
loop through first list
for each iteration of first loop,
loop through second list
Reply
#4
I have this assignment here and was hoping someone could provide the code so that I have a reference for my homework assignment. thanks.
IT 3210
Practice Assignment
 
Loops
 
Create the following lists or arrays as the input:
A = [1, 2]
B = [3, 4]
I want the following output
1, 3
1, 4
2, 3
2, 4
 
Shown in the actual program the top part is the input, and the bottom part is the output.
 
The question is what kind of loop or series of loops will produce this kind of output? 
 
Notice how the left side (1, and 2) are different than the right side (3, 4 then 3, 4)
Reply
#5
Welcome to the forum!

We're not going to write your homework for you, but we WILL be willing to help if you have any issues along the way.
So the place to start, is to write some code (there were tips on that previously), and if it doesn't work, gives errors, or the output is different from what you expect, we can help you on the right path.
But we won't do it for you.

Oh, and copy/pasting the same thing twice doesn't help anyone :p
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Creating a circular matrix with one input omnisierra 18 5,502 Oct-02-2020, 01:51 PM
Last Post: perfringo
  QUERY on Looping and creating lists as items within dictionaries ajayachander 3 2,284 Mar-26-2020, 02:03 PM
Last Post: ajayachander
  Help Formatting Print Statement (input from 3 lists) X 2 Hebruiser 11 6,202 Dec-06-2017, 04:47 PM
Last Post: gruntfutuk

Forum Jump:

User Panel Messages

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