1
+ {
2
+ "nbformat" : 4 ,
3
+ "nbformat_minor" : 0 ,
4
+ "metadata" : {
5
+ "colab" : {
6
+ "name" : " L_10 For loop .ipynb" ,
7
+ "provenance" : [],
8
+ "collapsed_sections" : [],
9
+ "authorship_tag" : " ABX9TyOYBUCMM6bauTgI4RCVCGaX"
10
+ },
11
+ "kernelspec" : {
12
+ "name" : " ir" ,
13
+ "display_name" : " R"
14
+ },
15
+ "language_info" : {
16
+ "name" : " R"
17
+ }
18
+ },
19
+ "cells" : [
20
+ {
21
+ "cell_type" : " code" ,
22
+ "source" : [
23
+ " for (i in 0:10) {\n " ,
24
+ " print(i)\n " ,
25
+ " }\n " ,
26
+ " \n " ,
27
+ " #q <- 0:10\n " ,
28
+ " #for (i in q) {\n " ,
29
+ " # print(i)\n " ,
30
+ " #}"
31
+ ],
32
+ "metadata" : {
33
+ "colab" : {
34
+ "base_uri" : " https://localhost:8080/"
35
+ },
36
+ "id" : " lZbDAfc26ESR" ,
37
+ "outputId" : " 7432fa3f-a749-4854-cccd-f4a46b035640"
38
+ },
39
+ "execution_count" : 107 ,
40
+ "outputs" : [
41
+ {
42
+ "output_type" : " stream" ,
43
+ "name" : " stdout" ,
44
+ "text" : [
45
+ " [1] 0\n " ,
46
+ " [1] 1\n " ,
47
+ " [1] 2\n " ,
48
+ " [1] 3\n " ,
49
+ " [1] 4\n " ,
50
+ " [1] 5\n " ,
51
+ " [1] 6\n " ,
52
+ " [1] 7\n " ,
53
+ " [1] 8\n " ,
54
+ " [1] 9\n " ,
55
+ " [1] 10\n "
56
+ ]
57
+ }
58
+ ]
59
+ },
60
+ {
61
+ "cell_type" : " code" ,
62
+ "source" : [
63
+ " fruits <- list(\" apple\" , \" banana\" , \" cherry\" )\n " ,
64
+ " \n " ,
65
+ " for (x in fruits) {\n " ,
66
+ " print(x)\n " ,
67
+ " }"
68
+ ],
69
+ "metadata" : {
70
+ "colab" : {
71
+ "base_uri" : " https://localhost:8080/"
72
+ },
73
+ "id" : " n_ChemLf6Mvl" ,
74
+ "outputId" : " 57ceadbc-f2b6-4123-9029-18b311ae340c"
75
+ },
76
+ "execution_count" : 103 ,
77
+ "outputs" : [
78
+ {
79
+ "output_type" : " stream" ,
80
+ "name" : " stdout" ,
81
+ "text" : [
82
+ " [1] \" apple\"\n " ,
83
+ " [1] \" banana\"\n " ,
84
+ " [1] \" cherry\"\n "
85
+ ]
86
+ }
87
+ ]
88
+ },
89
+ {
90
+ "cell_type" : " code" ,
91
+ "source" : [
92
+ " adj <- list(\" red\" , \" big\" , \" tasty\" )\n " ,
93
+ " \n " ,
94
+ " fruits <- list(\" apple\" , \" banana\" , \" cherry\" )\n " ,
95
+ " for (x in adj) {\n " ,
96
+ " for (y in fruits) {\n " ,
97
+ " print(paste(x, y))\n " ,
98
+ " }\n " ,
99
+ " }"
100
+ ],
101
+ "metadata" : {
102
+ "colab" : {
103
+ "base_uri" : " https://localhost:8080/"
104
+ },
105
+ "id" : " -cy6f57F7VGG" ,
106
+ "outputId" : " 5a5e366e-72f2-4f12-c71a-b953180cd9b7"
107
+ },
108
+ "execution_count" : 108 ,
109
+ "outputs" : [
110
+ {
111
+ "output_type" : " stream" ,
112
+ "name" : " stdout" ,
113
+ "text" : [
114
+ " [1] \" red apple\"\n " ,
115
+ " [1] \" red banana\"\n " ,
116
+ " [1] \" red cherry\"\n " ,
117
+ " [1] \" big apple\"\n " ,
118
+ " [1] \" big banana\"\n " ,
119
+ " [1] \" big cherry\"\n " ,
120
+ " [1] \" tasty apple\"\n " ,
121
+ " [1] \" tasty banana\"\n " ,
122
+ " [1] \" tasty cherry\"\n "
123
+ ]
124
+ }
125
+ ]
126
+ }
127
+ ]
128
+ }
0 commit comments