Hello,
Could someone, please, review this and give me some pointers?
I am 32% through the Business Intelligence Data Analyst path.
I am in the US, pacific standard time.
Hello,
Could someone, please, review this and give me some pointers?
I am 32% through the Business Intelligence Data Analyst path.
I am in the US, pacific standard time.
a few things:
paintings_dates=zip(paintings,dates)
title=list(paintings_dates)
print(title)
You can use list with zip.
From the docs: " zip is lazy: The elements won’t be processed until the iterable is iterated on, e.g. by a for
loop or by wrapping in a list
."
So:
paintings = list(zip(paintings, dates))
print(paintings)
[('The Two Fridas', 1939), ('My Dress Hangs Here', 1933), ('Tree of Hope', 1946), ('Self Portrait With Monkeys', 1940)]
This part:
title.append('The Broken Column')
title.append(1944)
title.append('The Wounded Deer')
title.append(1946)
title.append('Me and My Doll')
title.append(1937)
print(title) # add a print here to see the list results
#the results, not quite correct:
[('The Two Fridas', 1939), ('My Dress Hangs Here', 1933), ('Tree of Hope', 1946), ('Self Portrait With Monkeys', 1940), 'The Broken Column', 1944, 'The Wounded Deer', 1946, 'Me and My Doll', 1937]
You can append more than one item at a time. The way you have it written, you’re adding each item separately, rather than it’s own tuple. Which gives you what’s above.
Ex:
paintings.append(('The Broken Column', 1944))
paintings.append(('The Wounded Deer', 1946))
paintings.append(('Me and My Doll', 1937))
print(paintings)
[('The Two Fridas', 1939), ('My Dress Hangs Here', 1933), ('Tree of Hope', 1946), ('Self Portrait With Monkeys', 1940), ('The Broken Column', 1944), ('The Wounded Deer', 1946), ('Me and My Doll', 1937)]
This part:
length=len(paintings)
print()
to check your code.This part:
audio_tour_number = range(1,5)
If you used a print()
here, you’d see that the result is just 4. You need to cast it as a list as well. So, how would you accomplish that?
If the length of the list is 7, wouldn’t you need to adjust the range()
? (range’s inputs: (start index, stop index))
Docs: Built-in Functions — Python 3.12.4 documentation
This part:
paintings_audio_tour_number = zip(paintings,audio_tour_number)
master_list = list(paintings_audio_tour_number)
Do you want to use paintings
or 'title` here? Also, maybe put the audio tour number first.
Thank you so much, Lisa! I really appreciate your time. Your feedback was beyond helpful.
You’ve got a good start! There’s just some small issues. Someone once told me that, ‘print statements are your friend’ and it’s true! they help when debugging code.