Assignment 1

Assignment 1

My first assignment has three parts.

(a)A brief summary of Quarto

(b)3 Difference between R and Python

(c)NA example

  1. Python and R has syntax difference.

    assignment operator in Python:

    x = 1
    x
    1

    assignment operator in R:

    x <- 1
    x

2.writing function or a loop in R

```{r}
for (i in 1:10) {
  print(i)
}
```

writing function or a loop in Python `

::: {.cell execution_count=2}
``` {.python .cell-code}
for i in range(1,11):    
  print(i)
```

::: {.cell-output .cell-output-stdout}
```
1
2
3
4
5
6
7
8
9
10
```
:::
:::
  1. if structure in Python
  if(5 < 3): 
    print("Right")
  elif(3 == 5):
    print("Right")
  else:
    print("Right")
Right

if structure in R

```{r}
  if (5 < 3){
    print("Right")
  }else if (3 == 5){
    print("Right")
  }else {
    print("Right")}
```
library(dslabs) 
data(na_example) 
number_of_na <- sum(is.na(na_example)) 
print(number_of_na) cat("Toplam NA sayısı", number_of_na)
Back to top