Skip to content

Commit 8196cc9

Browse files
Add files via upload
1 parent 5c0cc43 commit 8196cc9

File tree

1 file changed

+198
-0
lines changed

1 file changed

+198
-0
lines changed

Assignment-16.ipynb

Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 11,
6+
"id": "779876d4",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"def stutter(st):\n",
11+
" print(st[0:2]+\"...\",st[0:2]+\"...\",st+\"?\")"
12+
]
13+
},
14+
{
15+
"cell_type": "code",
16+
"execution_count": 12,
17+
"id": "1f7aac2a",
18+
"metadata": {},
19+
"outputs": [
20+
{
21+
"name": "stdout",
22+
"output_type": "stream",
23+
"text": [
24+
"in... in... incredible?\n",
25+
"en... en... enthusiastic?\n",
26+
"ou... ou... outstanding?\n"
27+
]
28+
}
29+
],
30+
"source": [
31+
"stutter(\"incredible\")\n",
32+
"stutter(\"enthusiastic\")\n",
33+
"stutter(\"outstanding\")"
34+
]
35+
},
36+
{
37+
"cell_type": "code",
38+
"execution_count": 15,
39+
"id": "015427f0",
40+
"metadata": {},
41+
"outputs": [],
42+
"source": [
43+
"import math\n",
44+
"def radians_to_degrees(rad):\n",
45+
" return math.degrees(rad)"
46+
]
47+
},
48+
{
49+
"cell_type": "code",
50+
"execution_count": 20,
51+
"id": "29279f83",
52+
"metadata": {},
53+
"outputs": [
54+
{
55+
"name": "stdout",
56+
"output_type": "stream",
57+
"text": [
58+
"57.29577951308232\n",
59+
"1145.9155902616465\n",
60+
"2864.7889756541163\n"
61+
]
62+
}
63+
],
64+
"source": [
65+
"print(radians_to_degrees(1))\n",
66+
"print(radians_to_degrees(20))\n",
67+
"print(radians_to_degrees(50))"
68+
]
69+
},
70+
{
71+
"cell_type": "code",
72+
"execution_count": 28,
73+
"id": "3f95cc14",
74+
"metadata": {},
75+
"outputs": [],
76+
"source": [
77+
"def is_curson(num):\n",
78+
" for i in range(0,2):\n",
79+
" res=2**num+1\n",
80+
" mul=2*num+1\n",
81+
" if(res%mul==0):\n",
82+
" return True\n",
83+
" else:\n",
84+
" return False"
85+
]
86+
},
87+
{
88+
"cell_type": "code",
89+
"execution_count": 31,
90+
"id": "1b09b967",
91+
"metadata": {},
92+
"outputs": [
93+
{
94+
"name": "stdout",
95+
"output_type": "stream",
96+
"text": [
97+
"True\n",
98+
"False\n",
99+
"True\n"
100+
]
101+
}
102+
],
103+
"source": [
104+
"print(is_curson(5))\n",
105+
"print(is_curson(10))\n",
106+
"print(is_curson(14))"
107+
]
108+
},
109+
{
110+
"cell_type": "code",
111+
"execution_count": 66,
112+
"id": "fbdd7bf9",
113+
"metadata": {},
114+
"outputs": [],
115+
"source": [
116+
"def area_of_hexagon(side):\n",
117+
" return ((3 * math.sqrt(3)*(side * side)) / 2)"
118+
]
119+
},
120+
{
121+
"cell_type": "code",
122+
"execution_count": 51,
123+
"id": "85d035cd",
124+
"metadata": {},
125+
"outputs": [
126+
{
127+
"name": "stdout",
128+
"output_type": "stream",
129+
"text": [
130+
"2.6\n",
131+
"10.39\n",
132+
"23.38\n"
133+
]
134+
}
135+
],
136+
"source": [
137+
"print(round(area_of_hexagon(1),2))\n",
138+
"print(round(area_of_hexagon(2),2))\n",
139+
"print(round(area_of_hexagon(3),2))"
140+
]
141+
},
142+
{
143+
"cell_type": "code",
144+
"execution_count": 64,
145+
"id": "e0e1ea1c",
146+
"metadata": {},
147+
"outputs": [],
148+
"source": [
149+
"def binary(num):\n",
150+
" res = bin(num)\n",
151+
" return res[2:]"
152+
]
153+
},
154+
{
155+
"cell_type": "code",
156+
"execution_count": 65,
157+
"id": "2bdb0057",
158+
"metadata": {},
159+
"outputs": [
160+
{
161+
"name": "stdout",
162+
"output_type": "stream",
163+
"text": [
164+
"1\n",
165+
"101\n",
166+
"1010\n"
167+
]
168+
}
169+
],
170+
"source": [
171+
"print(binary(1))\n",
172+
"print(binary(5))\n",
173+
"print(binary(10))"
174+
]
175+
}
176+
],
177+
"metadata": {
178+
"kernelspec": {
179+
"display_name": "Python 3",
180+
"language": "python",
181+
"name": "python3"
182+
},
183+
"language_info": {
184+
"codemirror_mode": {
185+
"name": "ipython",
186+
"version": 3
187+
},
188+
"file_extension": ".py",
189+
"mimetype": "text/x-python",
190+
"name": "python",
191+
"nbconvert_exporter": "python",
192+
"pygments_lexer": "ipython3",
193+
"version": "3.6.9"
194+
}
195+
},
196+
"nbformat": 4,
197+
"nbformat_minor": 5
198+
}

0 commit comments

Comments
 (0)