Skip to content

Commit c41f6fb

Browse files
authored
Day2_updated
1 parent 4837528 commit c41f6fb

File tree

1 file changed

+213
-0
lines changed

1 file changed

+213
-0
lines changed

Python Day2 (1).ipynb

Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"id": "f6c133e0-aa94-45c3-94e8-7b04812152d6",
7+
"metadata": {},
8+
"outputs": [
9+
{
10+
"name": "stdout",
11+
"output_type": "stream",
12+
"text": [
13+
"abu siddig\n"
14+
]
15+
}
16+
],
17+
"source": [
18+
"fullname = 'abu siddig'\n",
19+
"print(fullname)"
20+
]
21+
},
22+
{
23+
"cell_type": "code",
24+
"execution_count": null,
25+
"id": "67787766-8117-4609-9a82-486d6aad1854",
26+
"metadata": {},
27+
"outputs": [],
28+
"source": [
29+
"Condition for variables:\n",
30+
" 1) No Namespace while declaring the variables\n",
31+
" 2) A variable name should not start with a number\n",
32+
" 3) A varaible name should not contain special charcters"
33+
]
34+
},
35+
{
36+
"cell_type": "code",
37+
"execution_count": 2,
38+
"id": "058937b4-12b0-4202-a08d-b75d08041a29",
39+
"metadata": {},
40+
"outputs": [
41+
{
42+
"ename": "SyntaxError",
43+
"evalue": "invalid syntax (91625403.py, line 1)",
44+
"output_type": "error",
45+
"traceback": [
46+
"\u001b[1;36m Cell \u001b[1;32mIn[2], line 1\u001b[1;36m\u001b[0m\n\u001b[1;33m full name = 'abu siddig'\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
47+
]
48+
}
49+
],
50+
"source": [
51+
"full name = 'abu siddig'\n",
52+
"print(full name)"
53+
]
54+
},
55+
{
56+
"cell_type": "code",
57+
"execution_count": 3,
58+
"id": "5c6db937-0b56-4da9-8585-d3cc58de1c5c",
59+
"metadata": {},
60+
"outputs": [
61+
{
62+
"ename": "SyntaxError",
63+
"evalue": "invalid decimal literal (2916292818.py, line 1)",
64+
"output_type": "error",
65+
"traceback": [
66+
"\u001b[1;36m Cell \u001b[1;32mIn[3], line 1\u001b[1;36m\u001b[0m\n\u001b[1;33m 1name = 'abu siddig'\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid decimal literal\n"
67+
]
68+
}
69+
],
70+
"source": [
71+
"1name = 'abu siddig'\n",
72+
"print(1name)"
73+
]
74+
},
75+
{
76+
"cell_type": "code",
77+
"execution_count": null,
78+
"id": "8bd70a92-04a3-463c-8f52-53333b13fd0f",
79+
"metadata": {},
80+
"outputs": [],
81+
"source": [
82+
"Datatypes: \n",
83+
"\n",
84+
"1. strings ===> str\n",
85+
"2. numbers =====> Integers ---> int and floats(decimals) --> 0.1,0.2 ====> floot\n",
86+
"3) lists ====>list\n",
87+
"4) tuples ===> tuple\n",
88+
"5) Dictionary ===> dict"
89+
]
90+
},
91+
{
92+
"cell_type": "code",
93+
"execution_count": null,
94+
"id": "148b4e7b-2b76-44b9-a8bc-d27718494dbf",
95+
"metadata": {},
96+
"outputs": [],
97+
"source": [
98+
"Classification of datatypes:\n",
99+
" Broadly datatypes are classified in to two categeroeis\n",
100+
"\t1> Mutable datatypes ===> these are flexible in nature ===> which we can edit and alter\n",
101+
"\t2> immutable datatypes ===> these are fixed in nature ==> which we cannot be able to edit and alter"
102+
]
103+
},
104+
{
105+
"cell_type": "code",
106+
"execution_count": null,
107+
"id": "0f2fb5e9-6b7d-48bd-89d5-54d1f9420a51",
108+
"metadata": {},
109+
"outputs": [],
110+
"source": [
111+
"Introduction to String datatypes:\n",
112+
"\n",
113+
"defination : A string is a series of charcters declared in quotes.\n",
114+
"\n",
115+
"Classification : it is classified as an immutable datatype\n",
116+
"\n",
117+
"how to declare the string ...?\n",
118+
"\n",
119+
"2 approaches : \n",
120+
" \n",
121+
"\t1) Single quotes 'sekhar'\n",
122+
"\t2) double quotes \"zainab\""
123+
]
124+
},
125+
{
126+
"cell_type": "code",
127+
"execution_count": null,
128+
"id": "7200170e-5c63-4821-aa73-d754c9d09872",
129+
"metadata": {},
130+
"outputs": [],
131+
"source": [
132+
"Introduction to string methods :\n",
133+
"\n",
134+
"type(firstname)\n",
135+
"str\n",
136+
"\n",
137+
"type(name)\n",
138+
"str"
139+
]
140+
},
141+
{
142+
"cell_type": "code",
143+
"execution_count": 4,
144+
"id": "87f402c4-d1d5-4b70-9252-4ec0c0351a33",
145+
"metadata": {},
146+
"outputs": [
147+
{
148+
"name": "stdout",
149+
"output_type": "stream",
150+
"text": [
151+
"Abu Siddig\n"
152+
]
153+
}
154+
],
155+
"source": [
156+
"fullname = 'abu siddig'\n",
157+
"print(fullname.title())"
158+
]
159+
},
160+
{
161+
"cell_type": "code",
162+
"execution_count": 5,
163+
"id": "a93088d7-bfbe-4021-9d8f-5337ac840ca6",
164+
"metadata": {},
165+
"outputs": [
166+
{
167+
"name": "stdout",
168+
"output_type": "stream",
169+
"text": [
170+
"Abu Siddig\n",
171+
"ABU SIDDIG\n",
172+
"abu siddig\n"
173+
]
174+
}
175+
],
176+
"source": [
177+
"fullname = 'abu siddig'\n",
178+
"print(fullname.title())\n",
179+
"print(fullname.upper())\n",
180+
"print(fullname.lower())"
181+
]
182+
},
183+
{
184+
"cell_type": "code",
185+
"execution_count": null,
186+
"id": "9cae839b-add4-431d-84e0-ccd34219fe1a",
187+
"metadata": {},
188+
"outputs": [],
189+
"source": []
190+
}
191+
],
192+
"metadata": {
193+
"kernelspec": {
194+
"display_name": "Python 3 (ipykernel)",
195+
"language": "python",
196+
"name": "python3"
197+
},
198+
"language_info": {
199+
"codemirror_mode": {
200+
"name": "ipython",
201+
"version": 3
202+
},
203+
"file_extension": ".py",
204+
"mimetype": "text/x-python",
205+
"name": "python",
206+
"nbconvert_exporter": "python",
207+
"pygments_lexer": "ipython3",
208+
"version": "3.12.7"
209+
}
210+
},
211+
"nbformat": 4,
212+
"nbformat_minor": 5
213+
}

0 commit comments

Comments
 (0)