Cats & Python

December 2, 2020   

Here are photos of my lovely kitten Mel. If you are wanting to adopt and you're in Austin, check out Austin Pets Alive!

Using R studio is wonderful because you can use reticulate to integrate code from R with Python. This is shown below:

#R code chunk
library(reticulate)
x <- 100
#Python code chunk
x = 3
print(r.x * x)
## 300.0

Isn't that neat?? Python is also easy to use as a calculator because you can always return the last thing evaluated using '_'. For example:

x + 1
## 4
_ * 2
## 8

Another unique aspect of Python is that it can be used to carry out multiple assignment. In other words, rather than having to assign a single variable at a time, you can assign multiple variables simultaneously. This is shown below:

a, b = x+1, x*x
a
## 4
b
## 9


comments powered by Disqus