Create a Flowchart for this code. #Declaring and initializing the list cars = ["Buick","Ford","Honda"] colors = ["Red","Blue","Black","White","Green"] aType = ["Sedan","SUV","Sports","Coupe","Truck"] #Using list comprehension to generate a list arr = [[0 for i in range(len(cars))] for j in range(len(cars)*len(colors))] #Outer for loop for i in range(0, len(colors)*len(cars)): #Inner for loop for j in range(0, len(cars)): #Check if j =0 if j == 0: #Initializing the list with cars(i%5) arr[i][j] = cars[int(i/5)] #chck if j = 1 if j == 1: #Initializing the list with colors(i%5) arr[i][j] = colors[int(i % 5)] #check if j = 2 if j == 2: #Initializing the list with aType(i%5) arr[i][j] = aType[int(i % 5)] #Iterating through the 2D list for i in range(0, len(arr)): #Print each list one by one print(arr[i])
Create a Flowchart for this code.
#Declaring and initializing the list
cars = ["Buick","Ford","Honda"]
colors = ["Red","Blue","Black","White","Green"]
aType = ["Sedan","SUV","Sports","Coupe","Truck"]
#Using list comprehension to generate a list
arr = [[0 for i in range(len(cars))] for j in range(len(cars)*len(colors))]
#Outer for loop
for i in range(0, len(colors)*len(cars)):
#Inner for loop
for j in range(0, len(cars)):
#Check if j =0
if j == 0:
#Initializing the list with cars(i%5)
arr[i][j] = cars[int(i/5)]
#chck if j = 1
if j == 1:
#Initializing the list with colors(i%5)
arr[i][j] = colors[int(i % 5)]
#check if j = 2
if j == 2:
#Initializing the list with aType(i%5)
arr[i][j] = aType[int(i % 5)]
#Iterating through the 2D list
for i in range(0, len(arr)):
#Print each list one by one
print(arr[i])
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images