Is this correct?

Hallo! Is that correct ?
Thank you!

titles=
poets=
dates=
i=0
for i in range(0,len(highlighted_poems_details)-1):
titles.append(highlighted_poems_details[i][0])
poets.append(highlighted_poems_details[i][1])
dates.append(highlighted_poems_details[i][2])
i=i+1
print(titles)
print(poets)
print(dates)

for i in range(0,len(highlighted_poems_details)-1):
print(‘The poem {} was published by {} in {}’.format(titles[i], poets[i], dates[i]))

why do you have the -1 in the range` ?

1 Like

you need to get rid of the -1 in both loops, and the i=0 and i=i+1 .
EX of answers =

for i in highlighted_poems_details:
titles.append(i[0])
poets.append(i[1])
dates.append(i[2])

for i in range(0, len(titles)):
print(‘The poem {TITLE} was published by {POET} in {DATE}.’.format(TITLE = titles[i], POET = poets[i], DATE = dates[i]))

Those are both right answers, you are making it a bit complicated detaching elements/variables for no reason there. Also don’t need to use the 0 in your ranges if they start at 0 (but i did it too lol), you also don’t need to use the range or length function in the first (for i in range(0,len(highlighted_poems_details)-1)). You are going through every element in a list so you don’t have to define the length parameters, the loop will go through each on its own.

My advice is you seem to be over thinking it a bit. Maybe try creating the simplest loops you can and if they don’t work, add to it element by element if you are having trouble with them. That way you will see what you don’t need and what works and doesn’t. Might take you a bit longer to do things but simplicity is important in code and it’ll help you in keeping it that way. Less complex your code the easier it is to do too, sometimes muddying it up with a lot of unnecessary stuff can work but once you get accustomed to it, could hurt you in long run.

Feel free to message me if you have questions, I am on here like 12 hours a day :sweat_smile: . I may be a bit OCD and I’m working towards professional A.I Engineering. If you are doing this, good chances we’ll be doing things in common. If you ever have questions, want someone to check your code or want someone to work/review code with, honestly don’t be shy.

Thank you very much! Your answer is really helpful!:slight_smile:

1 Like

No problem, happy to help :slight_smile: I only just started learning like 10 days ago now ( though im putting in over 12 hours a day), teaching and explaining my own work helps me learn too. So if you ever need help or have questions about anything please don’t be shy, can message me here on codeacademy or at Carpen-Them-Diemz#3114 on discord :). If you haven’t already joined the codeacademy discord I can send you an invite just let me know. Good luck on your programming journey!

Also actually, if you are doing data science/A.I and need someone to review code with I am always looking :stuck_out_tongue:

1 Like

Yes I am also new here doing data science career path and it would really helpful to review my code if you have time! So it would be great to send me an invite on discord, as i haven’ t joined yet…! Have fun on your programming journey!:slight_smile:

I can invite you before you make an account, but when u make your account and direct message me I can help you set it up. Infite you to the cdoecademy server and u can join the one I made as well, only 8 or so people so far but only been two days, and I am making it a bit more focused to AI and Data science. Good thing with it though is I control it so can do a lot more you couldn’t do on a proffesional orginization like codecademies and since its new everyone is active and most people new as well. Anyways yeah lol I have an area just for reviewing code on the server I made, we could review each others code there if you’d like.

Either way I do actually very much recommend making a discord account, probably the only social media I’d actually recommend to anyone. Its founder does a legitimate history of some sketchy stuff though so I wouldn’t use any real personal info lol. I don’t even know if he’s still in charge of the company but yeah. In all honesty too the only real difference is he did what every other social media does but without asking users permission or telling them, … Which is basically the case anyways for all other companies cuz I’m probably one of 10 people in the entire 8 billion strong world that actually ever reads user agreements lol. If you don’t care about them selling your data and info then not rly something to care about, basically every tech company does do this already probably including the cellphone provider and normal web surfing browser you’re using. Other than that one issue platform really is great.

I literally 30 seconds after writing that found out u can just look people up on discord, so heres a link that will bring you to my server, allow you to create your account, and u can find me in the server to message me so i can get you started on codecademies server and etc. Singularity Surfers (AI/ML/DL-DataScience) (Url has a limit so if it doesnt work by time u see it just let me know ill resend)