Skip to content

Commit 411f7fe

Browse files
Add files via upload
0 parents  commit 411f7fe

File tree

3 files changed

+432
-0
lines changed

3 files changed

+432
-0
lines changed

Assignment-1.ipynb

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [
8+
{
9+
"name": "stdout",
10+
"output_type": "stream",
11+
"text": [
12+
"Hello World!!\n"
13+
]
14+
}
15+
],
16+
"source": [
17+
"print(\"Hello World!!\")"
18+
]
19+
},
20+
{
21+
"cell_type": "code",
22+
"execution_count": 2,
23+
"metadata": {},
24+
"outputs": [
25+
{
26+
"name": "stdout",
27+
"output_type": "stream",
28+
"text": [
29+
"Addition is 30\n",
30+
"Division is 2.0\n"
31+
]
32+
}
33+
],
34+
"source": [
35+
"a = 20\n",
36+
"b = 10\n",
37+
"print(\"Addition is\",a+b) \n",
38+
"print(\"Division is\",a/b)\n"
39+
]
40+
},
41+
{
42+
"cell_type": "code",
43+
"execution_count": 4,
44+
"metadata": {},
45+
"outputs": [
46+
{
47+
"name": "stdout",
48+
"output_type": "stream",
49+
"text": [
50+
"Area of triangle is 45.0\n"
51+
]
52+
}
53+
],
54+
"source": [
55+
"base = 3\n",
56+
"height = 30\n",
57+
"Area= base*height/2\n",
58+
"print(\"Area of triangle is \",Area)"
59+
]
60+
},
61+
{
62+
"cell_type": "code",
63+
"execution_count": 5,
64+
"metadata": {},
65+
"outputs": [
66+
{
67+
"name": "stdout",
68+
"output_type": "stream",
69+
"text": [
70+
"Value of a: 30\n",
71+
"Value of b: 20\n"
72+
]
73+
}
74+
],
75+
"source": [
76+
"a,b = 20,30\n",
77+
"a,b = b,a\n",
78+
"print(\"Value of a:\", a)\n",
79+
"print(\"Value of b:\", b)\n"
80+
]
81+
},
82+
{
83+
"cell_type": "code",
84+
"execution_count": 7,
85+
"metadata": {},
86+
"outputs": [
87+
{
88+
"name": "stdout",
89+
"output_type": "stream",
90+
"text": [
91+
"8\n"
92+
]
93+
}
94+
],
95+
"source": [
96+
"import random\n",
97+
"print(random.randint(0,9))"
98+
]
99+
}
100+
],
101+
"metadata": {
102+
"kernelspec": {
103+
"display_name": "Python 3",
104+
"language": "python",
105+
"name": "python3"
106+
},
107+
"language_info": {
108+
"codemirror_mode": {
109+
"name": "ipython",
110+
"version": 3
111+
},
112+
"file_extension": ".py",
113+
"mimetype": "text/x-python",
114+
"name": "python",
115+
"nbconvert_exporter": "python",
116+
"pygments_lexer": "ipython3",
117+
"version": "3.8.5"
118+
}
119+
},
120+
"nbformat": 4,
121+
"nbformat_minor": 4
122+
}

Assignment-2.ipynb

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [
8+
{
9+
"name": "stdout",
10+
"output_type": "stream",
11+
"text": [
12+
"1.5534249999999998\n"
13+
]
14+
}
15+
],
16+
"source": [
17+
"km = 2.5\n",
18+
"miles = km * 0.62137\n",
19+
"print(miles)"
20+
]
21+
},
22+
{
23+
"cell_type": "code",
24+
"execution_count": 2,
25+
"metadata": {},
26+
"outputs": [
27+
{
28+
"name": "stdout",
29+
"output_type": "stream",
30+
"text": [
31+
"194.0\n"
32+
]
33+
}
34+
],
35+
"source": [
36+
"celcius = 90\n",
37+
"Fahrenheit = celcius * 9/5 + 32\n",
38+
"print(Fahrenheit)"
39+
]
40+
},
41+
{
42+
"cell_type": "code",
43+
"execution_count": 4,
44+
"metadata": {},
45+
"outputs": [
46+
{
47+
"name": "stdout",
48+
"output_type": "stream",
49+
"text": [
50+
" 2021\n",
51+
"\n",
52+
" January February March\n",
53+
"Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su\n",
54+
" 1 2 3 1 2 3 4 5 6 7 1 2 3 4 5 6 7\n",
55+
" 4 5 6 7 8 9 10 8 9 10 11 12 13 14 8 9 10 11 12 13 14\n",
56+
"11 12 13 14 15 16 17 15 16 17 18 19 20 21 15 16 17 18 19 20 21\n",
57+
"18 19 20 21 22 23 24 22 23 24 25 26 27 28 22 23 24 25 26 27 28\n",
58+
"25 26 27 28 29 30 31 29 30 31\n",
59+
"\n",
60+
" April May June\n",
61+
"Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su\n",
62+
" 1 2 3 4 1 2 1 2 3 4 5 6\n",
63+
" 5 6 7 8 9 10 11 3 4 5 6 7 8 9 7 8 9 10 11 12 13\n",
64+
"12 13 14 15 16 17 18 10 11 12 13 14 15 16 14 15 16 17 18 19 20\n",
65+
"19 20 21 22 23 24 25 17 18 19 20 21 22 23 21 22 23 24 25 26 27\n",
66+
"26 27 28 29 30 24 25 26 27 28 29 30 28 29 30\n",
67+
" 31\n",
68+
"\n",
69+
" July August September\n",
70+
"Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su\n",
71+
" 1 2 3 4 1 1 2 3 4 5\n",
72+
" 5 6 7 8 9 10 11 2 3 4 5 6 7 8 6 7 8 9 10 11 12\n",
73+
"12 13 14 15 16 17 18 9 10 11 12 13 14 15 13 14 15 16 17 18 19\n",
74+
"19 20 21 22 23 24 25 16 17 18 19 20 21 22 20 21 22 23 24 25 26\n",
75+
"26 27 28 29 30 31 23 24 25 26 27 28 29 27 28 29 30\n",
76+
" 30 31\n",
77+
"\n",
78+
" October November December\n",
79+
"Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su\n",
80+
" 1 2 3 1 2 3 4 5 6 7 1 2 3 4 5\n",
81+
" 4 5 6 7 8 9 10 8 9 10 11 12 13 14 6 7 8 9 10 11 12\n",
82+
"11 12 13 14 15 16 17 15 16 17 18 19 20 21 13 14 15 16 17 18 19\n",
83+
"18 19 20 21 22 23 24 22 23 24 25 26 27 28 20 21 22 23 24 25 26\n",
84+
"25 26 27 28 29 30 31 29 30 27 28 29 30 31\n",
85+
"\n"
86+
]
87+
}
88+
],
89+
"source": [
90+
"import calendar\n",
91+
"print(calendar.calendar(2021))"
92+
]
93+
},
94+
{
95+
"cell_type": "code",
96+
"execution_count": 5,
97+
"metadata": {},
98+
"outputs": [
99+
{
100+
"name": "stdout",
101+
"output_type": "stream",
102+
"text": [
103+
"The roots of the following quadratic equation are (-1+0j) (-1+0j)\n"
104+
]
105+
}
106+
],
107+
"source": [
108+
"# import complex math module\n",
109+
"import cmath\n",
110+
"\n",
111+
"a = 2\n",
112+
"b = 4\n",
113+
"c = 2\n",
114+
"# ax**2 + bx + c = 0\n",
115+
"# calculating the discriminant\n",
116+
"discriminant = (b**2) - (4 * a*c)\n",
117+
"\n",
118+
"# find two results\n",
119+
"sol1 = (-b-cmath.sqrt(discriminant))/(2 * a)\n",
120+
"sol2 = (-b + cmath.sqrt(discriminant))/(2 * a)\n",
121+
"\n",
122+
"# printing the results\n",
123+
"print('The roots of the following quadratic equation are ',sol1,\" \",sol2)\n"
124+
]
125+
},
126+
{
127+
"cell_type": "code",
128+
"execution_count": 6,
129+
"metadata": {},
130+
"outputs": [
131+
{
132+
"name": "stdout",
133+
"output_type": "stream",
134+
"text": [
135+
"Value of a: 50\n",
136+
"Value of b: 40\n"
137+
]
138+
}
139+
],
140+
"source": [
141+
"a,b = 40,50\n",
142+
"a,b = b,a\n",
143+
"print(\"Value of a:\", a)\n",
144+
"print(\"Value of b:\", b)"
145+
]
146+
}
147+
],
148+
"metadata": {
149+
"kernelspec": {
150+
"display_name": "Python 3",
151+
"language": "python",
152+
"name": "python3"
153+
},
154+
"language_info": {
155+
"codemirror_mode": {
156+
"name": "ipython",
157+
"version": 3
158+
},
159+
"file_extension": ".py",
160+
"mimetype": "text/x-python",
161+
"name": "python",
162+
"nbconvert_exporter": "python",
163+
"pygments_lexer": "ipython3",
164+
"version": "3.8.5"
165+
}
166+
},
167+
"nbformat": 4,
168+
"nbformat_minor": 4
169+
}

0 commit comments

Comments
 (0)