Skip to content

Commit 6f0d811

Browse files
Added Password Generator Project
1 parent 43ac7fe commit 6f0d811

File tree

1 file changed

+92
-10
lines changed

1 file changed

+92
-10
lines changed

Python Basic Projects.ipynb

Lines changed: 92 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 2,
5+
"execution_count": 1,
66
"metadata": {},
77
"outputs": [
88
{
@@ -17,15 +17,17 @@
1717
"I am going to think a number between 1-25\n",
1818
"Guess a number between 1-25 : 12\n",
1919
"your selction is high\n",
20+
"Wrong, try again: 10\n",
21+
"your selction is high\n",
2022
"Wrong, try again: 8\n",
2123
"your selction is high\n",
22-
"Wrong, try again: 4\n",
23-
"you selection is low\n",
2424
"Wrong, try again: 6\n",
25+
"your selction is high\n",
26+
"Wrong, try again: 4\n",
2527
"Your guess is correct\n",
2628
"\n",
27-
"The number was 6\n",
28-
"No of tries: 4\n"
29+
"The number was 4\n",
30+
"No of tries: 5\n"
2931
]
3032
}
3133
],
@@ -89,19 +91,17 @@
8991
},
9092
{
9193
"cell_type": "code",
92-
"execution_count": 7,
94+
"execution_count": 2,
9395
"metadata": {},
9496
"outputs": [
9597
{
9698
"name": "stdout",
9799
"output_type": "stream",
98100
"text": [
99101
"----Rock, Paper, Scissors Game----\n",
100-
"How many times would you like to play this game ? :2\n",
101-
"Enter your choice :Paper\n",
102-
"you win~ Paper cover Rock\n",
102+
"How many times would you like to play this game ? :1\n",
103103
"Enter your choice :Rock\n",
104-
"you win~ Rock smash Scissors\n",
104+
"Tie\n",
105105
"----Game Ends-----\n"
106106
]
107107
}
@@ -158,6 +158,88 @@
158158
"print('----Game Ends-----')\n"
159159
]
160160
},
161+
{
162+
"cell_type": "code",
163+
"execution_count": 12,
164+
"metadata": {},
165+
"outputs": [
166+
{
167+
"name": "stdout",
168+
"output_type": "stream",
169+
"text": [
170+
"This Program will create you a random password for your use\n",
171+
"Enter your password size :5\n",
172+
"The suggested password range is more than 6 characters.\n",
173+
"Please try again\n",
174+
"Enter your password size :3\n",
175+
"The suggested password range is more than 6 characters.\n",
176+
"Please try again\n",
177+
"Enter your password size :6\n",
178+
"Your Python Generated Password : yW3]cX\n"
179+
]
180+
}
181+
],
182+
"source": [
183+
"\"\"\"\n",
184+
"Password Generator\n",
185+
"Write a programme, which generates a random password for the user. Ask the user how long they want their password to be, and how many letters and numbers they want in their password. Have a mix of upper and lowercase letters, as well as numbers and symbols. ]\n",
186+
"The password should be a minimum of 6 characters long.\n",
187+
"\"\"\"\n",
188+
"\n",
189+
"import random\n",
190+
"\n",
191+
"print('This Program will create you a random password for your use')\n",
192+
"\n",
193+
"smallchar = 'abcdefghijklmnopqrstuvwxyz'\n",
194+
"largechar = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n",
195+
"number ='0123456789'\n",
196+
"splchar = '^!\\$%&/()=?{[]}+~#-_.:,;<>|\\\\'\n",
197+
"\n",
198+
"predefinedsize =6 #Suggested Length\n",
199+
"size = int(input('Enter your password size :')) #Input size\n",
200+
"\n",
201+
"while predefinedsize != size:\n",
202+
" print('The suggested password range is more than 6 characters.\\nPlease try again')\n",
203+
" size = int(input('Enter your password size :'))\n",
204+
"\n",
205+
"i = 0\n",
206+
"password = ''\n",
207+
" \n",
208+
"for i in range(size):\n",
209+
"\n",
210+
" password += random.choice(smallchar) + random.choice(largechar) +random.choice(number) + random.choice(splchar)\n",
211+
" \n",
212+
"print('Your Python Generated Password :',password[:size])\n"
213+
]
214+
},
215+
{
216+
"cell_type": "code",
217+
"execution_count": null,
218+
"metadata": {},
219+
"outputs": [],
220+
"source": []
221+
},
222+
{
223+
"cell_type": "code",
224+
"execution_count": null,
225+
"metadata": {},
226+
"outputs": [],
227+
"source": []
228+
},
229+
{
230+
"cell_type": "code",
231+
"execution_count": null,
232+
"metadata": {},
233+
"outputs": [],
234+
"source": []
235+
},
236+
{
237+
"cell_type": "code",
238+
"execution_count": null,
239+
"metadata": {},
240+
"outputs": [],
241+
"source": []
242+
},
161243
{
162244
"cell_type": "code",
163245
"execution_count": null,

0 commit comments

Comments
 (0)