help with this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

help with this code

hello! im trying to replace items 0,3,4 with pancakes. i managed to do item 0, but cant get the other 2 right. any suggestions? https://www.sololearn.com/compiler-playground/cqh63cpEANNI

14th Jun 2023, 9:47 PM
Ronal Castro
11 Answers
+ 1
Ronal Castro Pretty much what you just said if input == 0: list_name[0] = “Pancakes” print(list_name)
14th Jun 2023, 10:43 PM
Junior
Junior - avatar
0
cant use that key yet. need to use the indexing.
14th Jun 2023, 10:08 PM
Ronal Castro
0
@your mom cant use .replace due to the fact that im still in the indexing/list course. i need to use indexing to replace the strings
14th Jun 2023, 10:21 PM
Ronal Castro
0
Ronal Castro Oh sorry. Just realized you cant use replace on lists. Whoops.
14th Jun 2023, 10:22 PM
Junior
Junior - avatar
0
Ronal Castro You did it right the first time. breakfasts[3] = “Pancakes” breakfasts[4] = “Pancakes”
14th Jun 2023, 10:29 PM
Junior
Junior - avatar
0
@your mom i've tried day. AI denies the code.
14th Jun 2023, 10:32 PM
Ronal Castro
14th Jun 2023, 10:35 PM
Junior
Junior - avatar
0
pretty much the output, if i input 0, has to read 'pancakes', 'Waffles', 'Yogurt', 'Burrito', 'Toast' if i input 3, 'Donuts', 'Waffles', 'Yogurt', pancakes', 'Toast'] input 4, 'Donuts', 'Waffles', 'Yogurt', 'Burrito', 'pancakes']
14th Jun 2023, 10:35 PM
Ronal Castro
0
thanks!! totally forgot about the if/ else
14th Jun 2023, 10:49 PM
Ronal Castro
0
has anyone found the answer to this cause I've been stuck on this and I can't seem to understand where I'm going wrong https://www.sololearn.com/compiler-playground/cSro3W3YRkfo
12th Oct 2023, 6:49 PM
Junior Usuanlele
0
Junior Usuanlele you have to print the answer
12th Oct 2023, 8:21 PM
Junior
Junior - avatar