|
2 | 2 | "cells": [
|
3 | 3 | {
|
4 | 4 | "cell_type": "code",
|
5 |
| - "execution_count": 2, |
| 5 | + "execution_count": 1, |
6 | 6 | "metadata": {},
|
7 | 7 | "outputs": [
|
8 | 8 | {
|
|
17 | 17 | "I am going to think a number between 1-25\n",
|
18 | 18 | "Guess a number between 1-25 : 12\n",
|
19 | 19 | "your selction is high\n",
|
| 20 | + "Wrong, try again: 10\n", |
| 21 | + "your selction is high\n", |
20 | 22 | "Wrong, try again: 8\n",
|
21 | 23 | "your selction is high\n",
|
22 |
| - "Wrong, try again: 4\n", |
23 |
| - "you selection is low\n", |
24 | 24 | "Wrong, try again: 6\n",
|
| 25 | + "your selction is high\n", |
| 26 | + "Wrong, try again: 4\n", |
25 | 27 | "Your guess is correct\n",
|
26 | 28 | "\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" |
29 | 31 | ]
|
30 | 32 | }
|
31 | 33 | ],
|
|
89 | 91 | },
|
90 | 92 | {
|
91 | 93 | "cell_type": "code",
|
92 |
| - "execution_count": 7, |
| 94 | + "execution_count": 2, |
93 | 95 | "metadata": {},
|
94 | 96 | "outputs": [
|
95 | 97 | {
|
96 | 98 | "name": "stdout",
|
97 | 99 | "output_type": "stream",
|
98 | 100 | "text": [
|
99 | 101 | "----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", |
103 | 103 | "Enter your choice :Rock\n",
|
104 |
| - "you win~ Rock smash Scissors\n", |
| 104 | + "Tie\n", |
105 | 105 | "----Game Ends-----\n"
|
106 | 106 | ]
|
107 | 107 | }
|
|
158 | 158 | "print('----Game Ends-----')\n"
|
159 | 159 | ]
|
160 | 160 | },
|
| 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 | + }, |
161 | 243 | {
|
162 | 244 | "cell_type": "code",
|
163 | 245 | "execution_count": null,
|
|
0 commit comments