#Excercise 1 
a <- c(1,5,4,3,6)
b <- c(3,5,2,1,9)

a<=b
## [1]  TRUE  TRUE FALSE FALSE  TRUE
#Exercise 2
x <- c(12:4)
y <- c(0,1,2,0,1,2,0,1,2)
which(!is.finite(x/y))
## [1] 1 4 7
#Exercixe 3
x <- c(1,2,3,4)
k <- (x+2)[(!is.na(x)) &x >0]
k
## [1] 3 4 5 6
#Excercise 4
x <- c(2,4,6,8)
y <- c(TRUE,TRUE,FALSE,TRUE)
sum(x[y])
## [1] 14
#Exercise 5
x <- c(34, 56, 55, 87, NA, 4, 77, NA, 21, NA, 39)

#Answer:C 
sum(is.na(x))
## [1] 3
#Exercise 1
p <- c(2,7,8)
q <- c("A", "B", "C")
x <- list(p, q)
x[2]
## [[1]]
## [1] "A" "B" "C"
#Answer:"A" "B" "C"
#Exercise 2
 w <- c(2, 7, 8)
 v <- c("A", "B", "C")
 x <- list(w, v)
 #Answer 
 x[[2]][1] <- "K"
 x
## [[1]]
## [1] 2 7 8
## 
## [[2]]
## [1] "K" "B" "C"
#Exercise 3
a <- list ("x"=5, "y"=10, "z"=15)
#Answer C
sum(unlist(a))
## [1] 30
#Exercise 4
Newlist <- list(a=1:10, b="Good morning", c="Hi")

#Answer 
Newlist$a <- Newlist$a + 1
Newlist
## $a
##  [1]  2  3  4  5  6  7  8  9 10 11
## 
## $b
## [1] "Good morning"
## 
## $c
## [1] "Hi"
#Exercise 5
b <- list(a=1:10, c="Hello", d="AA")

#Answer
b$a[-2]
## [1]  1  3  4  5  6  7  8  9 10
#Exercise 6
x <- list(a=5:10, c="Hello", d="AA")

#Answer 
b$z <- "New Item"
#Exercise 7
y <- list("a", "b", "c")

#Answer
names (y) <- c("one", "two", "three")
#Exercise 8
x <- list(y=1:10, t="Hello", f="TT", r=5:20)

#Answer 
length (x$r)
## [1] 16
#Exercise 9
string <- "Grand Opening"

#Answer 
as.list (strsplit (string, " ")[[1]])
## [[1]]
## [1] "Grand"
## 
## [[2]]
## [1] "Opening"
#Exercise 10
 y <- list("a", "b", "c")
 q <- list("A", "B", "C", "a", "b", "c")
 
 #Answer
 setdiff (q, y)
## [[1]]
## [1] "A"
## 
## [[2]]
## [1] "B"
## 
## [[3]]
## [1] "C"