take the input and reassign the element in the index to x, then print the list | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

take the input and reassign the element in the index to x, then print the list

items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] num = int(input()) C=(items[num-1]) items[C]=("x") print(items) its working 3 out of 4 times, but the broken one is hidden, so i dont know what my error is. based on what its taught me, this should work

1st Feb 2021, 10:40 PM
Shane Bentley
Shane Bentley - avatar
2 Answers
+ 2
Maybe try C=num-1
1st Feb 2021, 10:51 PM
Abhay
Abhay - avatar
+ 2
I believe, the input value is the index to be used, but if it is a pro challenge, then non-pro users can't see the details of the challenge. You just need to set the; items[num] = 'x' Then output items
1st Feb 2021, 11:22 PM
ChaoticDawg
ChaoticDawg - avatar