Python 3.7: Nested List In Python

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

this is the list
a = ["car", ["bmw", "kia", "ford"], "Truck", ["pick up", "monster truck", ["ford", "gmc"]], "motorcycle", ["Honda"]]

abdulwaked
Автор

thies helped me alot! this was just exactly what i needed for my coding

incrediblesultan
Автор

how do i create a nested list without manually inputting the information

yoonweijie
Автор

Yep, Good one, kinda solved my problem, i guess i have to use loops to get the index at that deep Ford nested level.

tumzarelaxing
Автор

how do I create a nested list as you have done in the demo example?

snapblast
Автор

Are we able to take a specific char from the nested list; example "a"?

bansarishah
Автор

def iterlist(arr):
for item in arr:
if isinstance(item, list):
yield from iterlist(item)
else:
yield item

iteritem([‘car’, [‘BMW’, the rest of array....]

BAK
Автор

Say you have a list as such;
Schedule = [ ["read", 4], ["sleep", 5], ["play", 8]]
Is it possible to transverse through each and every item in the list using a for loop?

alexmephors
Автор

Hi Master Code,
Can you help me do the following?
x = [(1, 2, 3), (4, 5, 3), (2, 4, 7)]
[(x, y, z), (x, y, z), (x, y, z)]
I have a nested list like above. I need to plot a graph from a similar nested list when the nested list items are plotted as follows- the first item in each list is the x-value, the second is the y-value and the third is the z-value. Can this be done?
Thank you in advance

garrygorman
Автор

guys how can I take the first objects from each nested list using while ?for example 'car', 'BMW, 'Pick Up', 'Ford' etc

panoskiou
Автор

How can i communicat with you Mr. , I have some qustions for python language please??

eng.mariamalhussainy