+ 1

List operations

str <- readLines('stdin') x <- list("name"="James", "age"=42, "country"="canada","id"=5067) #your code goes here x[["id"]] <- str print(x) It fails what is wrong with this code?

2nd Dec 2021, 3:54 AM
Kim Hammar-Milliner
Kim Hammar-Milliner - avatar
8 Respuestas
+ 6
I'm asking for problems statement, without knowing that how anyone can help you As I don't see any syntax error in this code (acc. To me)
2nd Dec 2021, 11:42 AM
ÃKR
ÃKR - avatar
+ 5
Is it from code coach?
2nd Dec 2021, 4:12 AM
ÃKR
ÃKR - avatar
+ 5
Question ?
2nd Dec 2021, 4:21 AM
ÃKR
ÃKR - avatar
+ 1
I found it on the internet
2nd Dec 2021, 4:17 AM
Kim Hammar-Milliner
Kim Hammar-Milliner - avatar
+ 1
What is your question?
2nd Dec 2021, 4:34 AM
Kim Hammar-Milliner
Kim Hammar-Milliner - avatar
+ 1
The given code declares a list with some data and takes a string as input. You need to add the taken string to the list as a new field called "id", and output the resulting list.
3rd Dec 2021, 2:13 AM
Kim Hammar-Milliner
Kim Hammar-Milliner - avatar
0
It is now solved
4th Dec 2021, 2:59 AM
Kim Hammar-Milliner
Kim Hammar-Milliner - avatar
0
str <- readLines('stdin') x <- list("name"="James", "age"=42, "country"="USA") x[["id"]] <- str print(x) # it will work...
6th Jul 2022, 7:03 AM
Monika Raut
Monika Raut - avatar