0

List functions. Replace integer with string.

You are given a list of items. Write a program that takes a num number as input, reassigns the element with that index in the list to the value "x" and outputs the updated list. For example, for a given list [1, 2, 3, 4, 5] and input 3, the output should be: [1, 2, 3, "x", 5] My code comes out with no input items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] num = int(input()) items[num] = "x" Print (items) Cheers visph!

19th May 2021, 2:38 PM
Faz 'Straps' Zaf
Faz 'Straps' Zaf - avatar
1 Odpowiedź
+ 3
"print" should be all lowercased: python, as quite all language is case sensitive ^^
19th May 2021, 2:47 PM
visph
visph - avatar