Skip to content

Commit 315fd9e

Browse files
committed
4
1 parent a255ce0 commit 315fd9e

File tree

6 files changed

+254
-20
lines changed

6 files changed

+254
-20
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"cells": [],
3+
"metadata": {},
4+
"nbformat": 4,
5+
"nbformat_minor": 2
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"cells": [],
3+
"metadata": {},
4+
"nbformat": 4,
5+
"nbformat_minor": 2
6+
}

.ipynb_checkpoints/Week4-checkpoint.ipynb

Lines changed: 115 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,30 @@
99
},
1010
{
1111
"cell_type": "code",
12-
"execution_count": null,
12+
"execution_count": 2,
1313
"metadata": {},
14-
"outputs": [],
15-
"source": []
14+
"outputs": [
15+
{
16+
"name": "stdout",
17+
"output_type": "stream",
18+
"text": [
19+
"0 1 2 4 5 \n"
20+
]
21+
}
22+
],
23+
"source": [
24+
"for x in range(6):\n",
25+
" if (x == 3 or x == 6):\n",
26+
" continue\n",
27+
" print(x,end=' ')\n",
28+
"print(\"\")"
29+
]
1630
},
1731
{
1832
"cell_type": "markdown",
1933
"metadata": {},
2034
"source": [
21-
"Write a Python program to check the validity of password input by users.Validation :\n",
35+
"2. Write a Python program to check the validity of password input by users.Validation :\n",
2236
" At least 1 letter between [a-z] and 1 letter between [A-Z].\n",
2337
" At least 1 number between [0-9].\n",
2438
" At least 1 character from [$ # @].\n",
@@ -28,33 +42,124 @@
2842
},
2943
{
3044
"cell_type": "code",
31-
"execution_count": null,
45+
"execution_count": 3,
3246
"metadata": {},
33-
"outputs": [],
34-
"source": []
47+
"outputs": [
48+
{
49+
"name": "stdout",
50+
"output_type": "stream",
51+
"text": [
52+
"Input your password11\n",
53+
"Not a Valid Password\n"
54+
]
55+
}
56+
],
57+
"source": [
58+
"import re\n",
59+
"p= input(\"Input your password\")\n",
60+
"x = True\n",
61+
"while x: \n",
62+
" if (len(p)<6 or len(p)>16):\n",
63+
" break\n",
64+
" elif not re.search(\"[a-z]\",p):\n",
65+
" break\n",
66+
" elif not re.search(\"[0-9]\",p):\n",
67+
" break\n",
68+
" elif not re.search(\"[A-Z]\",p):\n",
69+
" break\n",
70+
" elif not re.search(\"[$#@]\",p):\n",
71+
" break\n",
72+
" elif re.search(\"\\s\",p):\n",
73+
" break\n",
74+
" else:\n",
75+
" print(\"Valid Password\")\n",
76+
" x=False\n",
77+
" break\n",
78+
"\n",
79+
"if x:\n",
80+
" print(\"Not a Valid Password\")"
81+
]
3582
},
3683
{
3784
"cell_type": "markdown",
3885
"metadata": {},
3986
"source": [
40-
"Maximum length 16 characters.\n"
87+
"3. Write a Python program to construct the following pattern, using a nested for loop."
88+
]
89+
},
90+
{
91+
"cell_type": "code",
92+
"execution_count": 5,
93+
"metadata": {},
94+
"outputs": [
95+
{
96+
"name": "stdout",
97+
"output_type": "stream",
98+
"text": [
99+
"\n",
100+
"* \n",
101+
"* * \n",
102+
"* * * \n",
103+
"* * * * \n",
104+
"* * * * * \n",
105+
"* * * * \n",
106+
"* * * \n",
107+
"* * \n",
108+
"* \n"
109+
]
110+
}
111+
],
112+
"source": [
113+
"n=5;\n",
114+
"for i in range(n):\n",
115+
" for j in range(i):\n",
116+
" print ('* ', end=\"\")\n",
117+
" print('')\n",
118+
"\n",
119+
"for i in range(n,0,-1):\n",
120+
" for j in range(i):\n",
121+
" print('* ', end=\"\")\n",
122+
" print('')"
41123
]
42124
},
43125
{
44126
"cell_type": "code",
45127
"execution_count": null,
46128
"metadata": {},
47129
"outputs": [],
130+
"source": []
131+
},
132+
{
133+
"cell_type": "code",
134+
"execution_count": 6,
135+
"metadata": {},
136+
"outputs": [
137+
{
138+
"ename": "SyntaxError",
139+
"evalue": "invalid syntax (<ipython-input-6-da6edc7350c1>, line 4)",
140+
"output_type": "error",
141+
"traceback": [
142+
"\u001b[1;36m File \u001b[1;32m\"<ipython-input-6-da6edc7350c1>\"\u001b[1;36m, line \u001b[1;32m4\u001b[0m\n\u001b[1;33m Accidents each year = [25, 79, 46, 90, 29, 88, 79, 93, 20, 11]\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
143+
]
144+
}
145+
],
48146
"source": [
49-
"\n"
147+
"Brand = [Ford, Ford, Chevy, Chevy, Honda, Ford, Honda, Honda, Ford, Chevy]\n",
148+
"Model = [F150, Escape, Charger, Charger, Civic, Escape, CRV, CRV, F150, Silverado]\n",
149+
"Type = [Pickup, SUV, Sedan, Sedan, Sedan, SUV, SUV, SUV, Pickup, Pickup]\n",
150+
"Accidents each year = [25, 79, 46, 90, 29, 88, 79, 93, 20, 11]\n",
151+
"#Find the brand and model of the safest car\n",
152+
"print(\"a\", min(Accidents each year))"
50153
]
51154
},
52155
{
53156
"cell_type": "code",
54157
"execution_count": null,
55158
"metadata": {},
56159
"outputs": [],
57-
"source": []
160+
"source": [
161+
"\n"
162+
]
58163
}
59164
],
60165
"metadata": {

Untitled.ipynb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"cells": [],
3+
"metadata": {},
4+
"nbformat": 4,
5+
"nbformat_minor": 2
6+
}

Untitled1.ipynb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"cells": [],
3+
"metadata": {},
4+
"nbformat": 4,
5+
"nbformat_minor": 2
6+
}

Week4.ipynb

Lines changed: 115 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,30 @@
99
},
1010
{
1111
"cell_type": "code",
12-
"execution_count": null,
12+
"execution_count": 2,
1313
"metadata": {},
14-
"outputs": [],
15-
"source": []
14+
"outputs": [
15+
{
16+
"name": "stdout",
17+
"output_type": "stream",
18+
"text": [
19+
"0 1 2 4 5 \n"
20+
]
21+
}
22+
],
23+
"source": [
24+
"for x in range(6):\n",
25+
" if (x == 3 or x == 6):\n",
26+
" continue\n",
27+
" print(x,end=' ')\n",
28+
"print(\"\")"
29+
]
1630
},
1731
{
1832
"cell_type": "markdown",
1933
"metadata": {},
2034
"source": [
21-
"Write a Python program to check the validity of password input by users.Validation :\n",
35+
"2. Write a Python program to check the validity of password input by users.Validation :\n",
2236
" At least 1 letter between [a-z] and 1 letter between [A-Z].\n",
2337
" At least 1 number between [0-9].\n",
2438
" At least 1 character from [$ # @].\n",
@@ -28,33 +42,124 @@
2842
},
2943
{
3044
"cell_type": "code",
31-
"execution_count": null,
45+
"execution_count": 3,
3246
"metadata": {},
33-
"outputs": [],
34-
"source": []
47+
"outputs": [
48+
{
49+
"name": "stdout",
50+
"output_type": "stream",
51+
"text": [
52+
"Input your password11\n",
53+
"Not a Valid Password\n"
54+
]
55+
}
56+
],
57+
"source": [
58+
"import re\n",
59+
"p= input(\"Input your password\")\n",
60+
"x = True\n",
61+
"while x: \n",
62+
" if (len(p)<6 or len(p)>16):\n",
63+
" break\n",
64+
" elif not re.search(\"[a-z]\",p):\n",
65+
" break\n",
66+
" elif not re.search(\"[0-9]\",p):\n",
67+
" break\n",
68+
" elif not re.search(\"[A-Z]\",p):\n",
69+
" break\n",
70+
" elif not re.search(\"[$#@]\",p):\n",
71+
" break\n",
72+
" elif re.search(\"\\s\",p):\n",
73+
" break\n",
74+
" else:\n",
75+
" print(\"Valid Password\")\n",
76+
" x=False\n",
77+
" break\n",
78+
"\n",
79+
"if x:\n",
80+
" print(\"Not a Valid Password\")"
81+
]
3582
},
3683
{
3784
"cell_type": "markdown",
3885
"metadata": {},
3986
"source": [
40-
"Maximum length 16 characters.\n"
87+
"3. Write a Python program to construct the following pattern, using a nested for loop."
88+
]
89+
},
90+
{
91+
"cell_type": "code",
92+
"execution_count": 5,
93+
"metadata": {},
94+
"outputs": [
95+
{
96+
"name": "stdout",
97+
"output_type": "stream",
98+
"text": [
99+
"\n",
100+
"* \n",
101+
"* * \n",
102+
"* * * \n",
103+
"* * * * \n",
104+
"* * * * * \n",
105+
"* * * * \n",
106+
"* * * \n",
107+
"* * \n",
108+
"* \n"
109+
]
110+
}
111+
],
112+
"source": [
113+
"n=5;\n",
114+
"for i in range(n):\n",
115+
" for j in range(i):\n",
116+
" print ('* ', end=\"\")\n",
117+
" print('')\n",
118+
"\n",
119+
"for i in range(n,0,-1):\n",
120+
" for j in range(i):\n",
121+
" print('* ', end=\"\")\n",
122+
" print('')"
41123
]
42124
},
43125
{
44126
"cell_type": "code",
45127
"execution_count": null,
46128
"metadata": {},
47129
"outputs": [],
130+
"source": []
131+
},
132+
{
133+
"cell_type": "code",
134+
"execution_count": 7,
135+
"metadata": {},
136+
"outputs": [
137+
{
138+
"ename": "SyntaxError",
139+
"evalue": "invalid syntax (<ipython-input-7-70de1be1fcb7>, line 4)",
140+
"output_type": "error",
141+
"traceback": [
142+
"\u001b[1;36m File \u001b[1;32m\"<ipython-input-7-70de1be1fcb7>\"\u001b[1;36m, line \u001b[1;32m4\u001b[0m\n\u001b[1;33m Accidents each year = [25, 79, 46, 90, 29, 88, 79, 93, 20, 11]\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
143+
]
144+
}
145+
],
48146
"source": [
49-
"\n"
147+
"Brand = [Ford, Ford, Chevy, Chevy, Honda, Ford, Honda, Honda, Ford, Chevy]\n",
148+
"Model = [F150, Escape, Charger, Charger, Civic, Escape, CRV, CRV, F150, Silverado]\n",
149+
"Type = [Pickup, SUV, Sedan, Sedan, Sedan, SUV, SUV, SUV, Pickup, Pickup]\n",
150+
"Accidents each year = [25, 79, 46, 90, 29, 88, 79, 93, 20, 11]\n",
151+
"#Find the brand and model of the safest car\n",
152+
"min(Accidents each year)"
50153
]
51154
},
52155
{
53156
"cell_type": "code",
54157
"execution_count": null,
55158
"metadata": {},
56159
"outputs": [],
57-
"source": []
160+
"source": [
161+
"\n"
162+
]
58163
}
59164
],
60165
"metadata": {

0 commit comments

Comments
 (0)