You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 68ced35
Browse filesBrowse the repository at this point in the historyBrowse files
"1.Create 3 variables to store street, city and country, now create address variable to store entire address. Use two ways of creating this variable, one using + operator and the other using f-string. Now Print the address in such a way that the street, city and country prints in a separate line."
"This slices the string from index 6 up to (but not including) index 14.\n",
136
+
"\n",
137
+
"It gives: \"revolves\"\n",
138
+
"\n",
139
+
"sentence[-3:]\n",
140
+
"\n",
141
+
"Negative indexing starts from the end of the string.\n",
142
+
"\n",
143
+
"-3: means from the third character from the end to the end.\n",
144
+
"\n",
145
+
"It gives: \"sun\""
146
+
],
147
+
"metadata": {
148
+
"id": "I1iZNgzmNZMY"
149
+
}
150
+
},
151
+
{
152
+
"cell_type": "markdown",
153
+
"source": [
154
+
"3.Create two variables to store how many fruits and vegetables you eat in a day. Now Print \"I eat x veggies and y fruits daily\" where x and y presents vegetables and fruits that you eat everyday. Use python f string for this."
155
+
],
156
+
"metadata": {
157
+
"id": "EQ2R68e2NjH8"
158
+
}
159
+
},
160
+
{
161
+
"cell_type": "code",
162
+
"source": [
163
+
"fruits = 2\n",
164
+
"vegetables = 3\n",
165
+
"\n",
166
+
"print(f\"I eat {vegetables} veggies and {fruits} fruits daily\")"
"The f-string lets you insert variables directly into the string using {}.\n",
200
+
"\n"
201
+
],
202
+
"metadata": {
203
+
"id": "MEprQw-MN4OH"
204
+
}
205
+
},
206
+
{
207
+
"cell_type": "markdown",
208
+
"source": [
209
+
"4.I have a string variable called s='maine 200 banana khaye'. This of course is a wrong statement, the correct statement is 'maine 10 samosa khaye'. Replace incorrect words in original strong with new ones and print the new string. Also try to do this in one line."
0 commit comments