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
11 Answers
+ 1
Ronal Castro Pretty much what you just said
if input == 0:
list_name[0] = “Pancakes”
print(list_name)
0
cant use that key yet. need to use the indexing.
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
0
Ronal Castro Oh sorry. Just realized you cant use replace on lists. Whoops.
0
Ronal Castro You did it right the first time.
breakfasts[3] = “Pancakes”
breakfasts[4] = “Pancakes”
0
@your mom i've tried day. AI denies the code.
0
Ronal Castro AI?
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']
0
thanks!! totally forgot about the if/ else
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
0
Junior Usuanlele you have to print the answer