1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
---
title: "Python Multiple Print & Comments"
output: md_document
---
```{r 'setup'}
library(reticulate)
```
prose
```{python}
y = [2, 4, 6]
# Comment about len
print(len(y))
# This comment about type should be attached to the code below.
print(type(y))
```
prose
```{python, collapse=TRUE}
# Same Example with Collapsed Chunk
y = [2, 4, 6]
# Note the output of this command should available immediately below it (like with R).
print(len(y))
# Comment about type should be attached to the code below (like R).
# The output from the previous command should not be part of this
print(type(y))
```
```{r}
# Comparative Code for R
x = c(2, 4, 6)
# Output of length() is given just after the command (as expected)
print(length(x))
# Comment about class is attached to the code below (as expected)
print(class(x))
```
```{r, collapse=TRUE}
# Comparative Code for R
x = c(2, 4, 6)
# Output of length() is given just after the command (as expected)
print(length(x))
# Comment about class is attached to the code below (as expected)
print(class(x))
```
|