What will be the output of the following R code? [code] > f <- function(num) { + hello <- "Hello, world!\n" + for(i in seq_len(num)) { +

What will be the output of the following R code?
Code:
> f <- function(num) {
+ hello <- "Hello, world!\n"
+ for(i in seq_len(num)) {
+                    cat(hello)
+ }
+                    chars <- nchar(hello) * num
+                    chars
+ }
> meaningoflife <- f(3)
> print(meaningoflife)
A. 32
B. 42
C. 52
D. 46
 

Tìm kiếm

Back
Top