├── .gitignore ├── LICENSE ├── README.md ├── calculator.py ├── countdown_timer.py ├── dice_rolling.py ├── hangman.py ├── hangman_wordlist.txt ├── number_guessing.py ├── password_strength_checker.py ├── rock_paper_scissor.py ├── tic_tac_toe.py ├── user_management_system.py └── value_converter.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 95 | __pypackages__/ 96 | 97 | # Celery stuff 98 | celerybeat-schedule 99 | celerybeat.pid 100 | 101 | # SageMath parsed files 102 | *.sage.py 103 | 104 | # Environments 105 | .env 106 | .venv 107 | env/ 108 | venv/ 109 | ENV/ 110 | env.bak/ 111 | venv.bak/ 112 | 113 | # Spyder project settings 114 | .spyderproject 115 | .spyproject 116 | 117 | # Rope project settings 118 | .ropeproject 119 | 120 | # mkdocs documentation 121 | /site 122 | 123 | # mypy 124 | .mypy_cache/ 125 | .dmypy.json 126 | dmypy.json 127 | 128 | # Pyre type checker 129 | .pyre/ 130 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 TheSpecialCoder 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Top-10-Easy-Python-Project-Ideas-For-Beginners 2 | This GitHub repository has the code for top 10 easy python project ideas for beginners. You can also refer to my video on YouTube on this exact topic 3 | ## YouTube Video Link 4 | [![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/JsFgVJgev48/0.jpg)](https://www.youtube.com/watch?v=JsFgVJgev48) 5 | 6 | ## About The Repo 7 | This repository contains 10 python scripts that contain the 10 projects that I discussed on my YouTube video as 8 | **Top 10 Easy Python Project Ideas For Beginners** 9 | 10 | ## Projects 11 | 1. Calculator (calculator.py) 12 | 2. Dice Rolling Simulator (dice_rolling.py) 13 | 3. Number Guessing Game (number_guessing.py) 14 | 4. Value Converter (value_converter.py) 15 | 5. Countdown Timer (countdown_timer.py) 16 | 6. Password Strength Checker (password_strength_checker.py) 17 | 7. Hangman (hangman.py) 18 | 8. Tic Tac Toe (tic_tac_toe.py) 19 | 9. Rock Paper Scissor (rock_paper_scissor.py) 20 | 10. User Management System (user_management_system.py) 21 | 22 | ## Conclusion 23 | Although I have provided the code for these projects, I would request beginner programmers to try to make these projects by themselves, as that would add up to their programming knowledge and skills. 24 | 25 | If you liked these projects, follow me on:\ 26 | YouTube: [YouTube](http://www.youtube.com/allaboutpython?sub_confirmation=1)\ 27 | Instagram: [Instagram](https://www.instagram.com/itsallaboutpython)\ 28 | Blog Site: [Site](https://itsallaboutpython.blogspot.com/)\ 29 | GitHub: [GitHub](https://github.com/visheshdvivedi/) 30 | -------------------------------------------------------------------------------- /calculator.py: -------------------------------------------------------------------------------- 1 | print("===== Welcome to Calculator App =====\n") 2 | while 1: 3 | print("What would you like to do:-") 4 | print("1. Addition") 5 | print("2. Subtraction") 6 | print("3 Multiplication") 7 | print("4. Division") 8 | print("5. Exit") 9 | choice = int(input("Enter your choice: ")) 10 | num1 = int(input("Enter first number: ")) 11 | num2 = int(input("Enter second number: ")) 12 | if choice == 1: 13 | print("Output: ", num1+num2) 14 | elif choice == 2: 15 | print("Output: ", num1-num2) 16 | elif choice == 3: 17 | print("Output: ", num1*num2) 18 | elif choice == 4: 19 | print("Output: ", num1/num2) 20 | elif choice == 5: 21 | print("Exiting...") 22 | break 23 | print() 24 | -------------------------------------------------------------------------------- /countdown_timer.py: -------------------------------------------------------------------------------- 1 | import time 2 | 3 | def set_countdown(): 4 | seconds = int(input("Enter amount of seconds: ")) 5 | print('Countdown starts now...') 6 | temp = seconds 7 | while temp != 0: 8 | if temp != seconds: 9 | print('\b'*len(str(temp)), end='') 10 | time.sleep(1) 11 | temp -= 1 12 | print(temp, end='') 13 | print("\nCountdown ended...\n") 14 | 15 | print("===== Welcome to Countdown Timer =====") 16 | while 1: 17 | choice = input("Do you want to set a countdown (y/n): ") 18 | if 'y' in choice.lower(): 19 | set_countdown() 20 | elif 'n' in choice.lower(): 21 | print('Exiting...') 22 | break 23 | else: 24 | print('Invalid input...please try again') -------------------------------------------------------------------------------- /dice_rolling.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | def roll_dice(): 4 | dice_number = random.randint(1, 6) 5 | return dice_number 6 | 7 | print("===== Welcome to Dice Rolling Simulator =====") 8 | while 1: 9 | choice = input("Do you wanna roll a dice (y/n)") 10 | if 'y' in choice.lower(): 11 | print("Rolling dice...") 12 | number = roll_dice() 13 | print("Dice has the number:", number) 14 | elif 'n' in choice.lower(): 15 | print('Exiting...') 16 | break 17 | else: 18 | print("Invalid input...please try again") -------------------------------------------------------------------------------- /hangman.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | def get_random_word_from_wordlist(): 4 | wordlist = [] 5 | with open("hangman_wordlist.txt", 'r') as file: 6 | wordlist = file.read().split('\n') 7 | word = random.choice(wordlist) 8 | return word 9 | 10 | def get_some_letters(word): 11 | letters = [] 12 | temp = '_'*len(word) 13 | for char in list(word): 14 | if char not in letters: 15 | letters.append(char) 16 | character = random.choice(letters) 17 | for num, char in enumerate(list(word)): 18 | if char == character: 19 | templist = list(temp) 20 | templist[num] = char 21 | temp = ''.join(templist) 22 | return temp 23 | 24 | def draw_hangman(chances): 25 | if chances == 0: 26 | print("----------") 27 | print(" ( )-| ") 28 | print(" - | - ") 29 | print(" / \ ") 30 | elif chances == 1: 31 | print("----------") 32 | print(" ( )- ") 33 | print(" - | - ") 34 | print(" / \ ") 35 | elif chances == 2: 36 | print("----------") 37 | print(" ( ) ") 38 | print(" - | - ") 39 | print(" / \ ") 40 | elif chances == 3: 41 | print("----------") 42 | print(" ( ) ") 43 | print(" - | - ") 44 | print(" / ") 45 | elif chances == 4: 46 | print("----------") 47 | print(" ( ) ") 48 | print(" - | - ") 49 | print(" ") 50 | elif chances == 5: 51 | print("----------") 52 | print(" ( ) ") 53 | print(" | ") 54 | print(" ") 55 | elif chances == 6: 56 | print("----------") 57 | print(" ( ) ") 58 | print(" ") 59 | print(" ") 60 | 61 | def start_hangman_game(): 62 | word = get_random_word_from_wordlist() 63 | temp = get_some_letters(word) 64 | chances = 7 65 | found = False 66 | while 1: 67 | if chances == 0: 68 | print(f"Sorry !!! You Lost, the word was: {word}") 69 | break 70 | print("=== Guess the word ===") 71 | print(temp, end='') 72 | print(f"\t(word has {len(word)} letters)") 73 | print(f"Chances left: {chances}") 74 | character = input("Enter the character you think the word may have: ") 75 | if len(character) > 1 or not character.isalpha(): 76 | print("Please enter a single alphabet only") 77 | continue 78 | else: 79 | for num, char in enumerate(list(word)): 80 | if char == character: 81 | templist = list(temp) 82 | templist[num] = char 83 | temp = ''.join(templist) 84 | found = True 85 | if found: 86 | found = False 87 | else: 88 | chances -= 1 89 | if '_' not in temp: 90 | print(f"\nYou Won !!! The word was: {word}") 91 | print(f"You got it in {7 - chances} chances") 92 | break 93 | else: 94 | draw_hangman(chances) 95 | print() 96 | 97 | print("===== Welcome to Hangman Game =====") 98 | while 1: 99 | choice = input("Do you wanna play hangman (y/n): ") 100 | if 'y' in choice.lower(): 101 | start_hangman_game() 102 | elif 'n' in choice.lower(): 103 | print('Exiting...') 104 | break 105 | else: 106 | print("Invalid input...please try again") 107 | print("\n") -------------------------------------------------------------------------------- /hangman_wordlist.txt: -------------------------------------------------------------------------------- 1 | able 2 | about 3 | account 4 | acid 5 | across 6 | act 7 | addition 8 | adjustment 9 | advertisement 10 | after 11 | again 12 | against 13 | agreement 14 | air 15 | all 16 | almost 17 | among 18 | amount 19 | amusement 20 | and 21 | angle 22 | angry 23 | animal 24 | answer 25 | ant 26 | any 27 | apparatus 28 | apple 29 | approval 30 | arch 31 | argument 32 | arm 33 | army 34 | art 35 | as 36 | at 37 | attack 38 | attempt 39 | attention 40 | attraction 41 | authority 42 | automatic 43 | awake 44 | baby 45 | back 46 | bad 47 | bag 48 | balance 49 | ball 50 | band 51 | base 52 | basin 53 | basket 54 | bath 55 | be 56 | beautiful 57 | because 58 | bed 59 | bee 60 | before 61 | behaviour 62 | belief 63 | bell 64 | bent 65 | berry 66 | between 67 | bird 68 | birth 69 | bit 70 | bite 71 | bitter 72 | black 73 | blade 74 | blood 75 | blow 76 | blue 77 | board 78 | boat 79 | body 80 | boiling 81 | bone 82 | book 83 | boot 84 | bottle 85 | box 86 | boy 87 | brain 88 | brake 89 | branch 90 | brass 91 | bread 92 | breath 93 | brick 94 | bridge 95 | bright 96 | broken 97 | brother 98 | brown 99 | brush 100 | bucket 101 | building 102 | bulb 103 | burn 104 | burst 105 | business 106 | but 107 | butter 108 | button 109 | by 110 | cake 111 | camera 112 | canvas 113 | card 114 | care 115 | carriage 116 | cart 117 | cat 118 | cause 119 | certain 120 | chain 121 | chalk 122 | chance 123 | change 124 | cheap 125 | cheese 126 | chemical 127 | chest 128 | chief 129 | chin 130 | church 131 | circle 132 | clean 133 | clear 134 | clock 135 | cloth 136 | cloud 137 | coal 138 | coat 139 | cold 140 | collar 141 | colour 142 | comb 143 | come 144 | comfort 145 | committee 146 | common 147 | company 148 | comparison 149 | competition 150 | complete 151 | complex 152 | condition 153 | connection 154 | conscious 155 | control 156 | cook 157 | copper 158 | copy 159 | cord 160 | cork 161 | cotton 162 | cough 163 | country 164 | cover 165 | cow 166 | crack 167 | credit 168 | crime 169 | cruel 170 | crush 171 | cry 172 | cup 173 | cup 174 | current 175 | curtain 176 | curve 177 | cushion 178 | damage 179 | danger 180 | dark 181 | daughter 182 | day 183 | dead 184 | dear 185 | death 186 | debt 187 | decision 188 | deep 189 | degree 190 | delicate 191 | dependent 192 | design 193 | desire 194 | destruction 195 | detail 196 | development 197 | different 198 | digestion 199 | direction 200 | dirty 201 | discovery 202 | discussion 203 | disease 204 | disgust 205 | distance 206 | distribution 207 | division 208 | do 209 | dog 210 | door 211 | doubt 212 | down 213 | drain 214 | drawer 215 | dress 216 | drink 217 | driving 218 | drop 219 | dry 220 | dust 221 | ear 222 | early 223 | earth 224 | east 225 | edge 226 | education 227 | effect 228 | egg 229 | elastic 230 | electric 231 | end 232 | engine 233 | enough 234 | equal 235 | error 236 | even 237 | event 238 | ever 239 | every 240 | example 241 | exchange 242 | existence 243 | expansion 244 | experience 245 | expert 246 | eye 247 | face 248 | fact 249 | fall 250 | false 251 | family 252 | far 253 | farm 254 | fat 255 | father 256 | fear 257 | feather 258 | feeble 259 | feeling 260 | female 261 | fertile 262 | fiction 263 | field 264 | fight 265 | finger 266 | fire 267 | first 268 | fish 269 | fixed 270 | flag 271 | flame 272 | flat 273 | flight 274 | floor 275 | flower 276 | fly 277 | fold 278 | food 279 | foolish 280 | foot 281 | for 282 | force 283 | fork 284 | form 285 | forward 286 | fowl 287 | frame 288 | free 289 | frequent 290 | friend 291 | from 292 | front 293 | fruit 294 | full 295 | future 296 | garden 297 | general 298 | get 299 | girl 300 | give 301 | glass 302 | glove 303 | go 304 | goat 305 | gold 306 | good 307 | government 308 | grain 309 | grass 310 | great 311 | green 312 | grey 313 | grip 314 | group 315 | growth 316 | guide 317 | gun 318 | hair 319 | hammer 320 | hand 321 | hanging 322 | happy 323 | harbour 324 | hard 325 | harmony 326 | hat 327 | hate 328 | have 329 | he 330 | head 331 | healthy 332 | hear 333 | hearing 334 | heart 335 | heat 336 | help 337 | high 338 | history 339 | hole 340 | hollow 341 | hook 342 | hope 343 | horn 344 | horse 345 | hospital 346 | hour 347 | house 348 | how 349 | humour 350 | I 351 | ice 352 | idea 353 | if 354 | ill 355 | important 356 | impulse 357 | in 358 | increase 359 | industry 360 | ink 361 | insect 362 | instrument 363 | insurance 364 | interest 365 | invention 366 | iron 367 | island 368 | jelly 369 | jewel 370 | join 371 | journey 372 | judge 373 | jump 374 | keep 375 | kettle 376 | key 377 | kick 378 | kind 379 | kiss 380 | knee 381 | knife 382 | knot 383 | knowledge 384 | land 385 | language 386 | last 387 | late 388 | laugh 389 | law 390 | lead 391 | leaf 392 | learning 393 | leather 394 | left 395 | leg 396 | let 397 | letter 398 | level 399 | library 400 | lift 401 | light 402 | like 403 | limit 404 | line 405 | linen 406 | lip 407 | liquid 408 | list 409 | little 410 | living 411 | lock 412 | long 413 | look 414 | loose 415 | loss 416 | loud 417 | love 418 | low 419 | machine 420 | make 421 | male 422 | man 423 | manager 424 | map 425 | mark 426 | market 427 | married 428 | mass 429 | match 430 | material 431 | may 432 | meal 433 | measure 434 | meat 435 | medical 436 | meeting 437 | memory 438 | metal 439 | middle 440 | military 441 | milk 442 | mind 443 | mine 444 | minute 445 | mist 446 | mixed 447 | money 448 | monkey 449 | month 450 | moon 451 | morning 452 | mother 453 | motion 454 | mountain 455 | mouth 456 | move 457 | much 458 | muscle 459 | music 460 | nail 461 | name 462 | narrow 463 | nation 464 | natural 465 | near 466 | necessary 467 | neck 468 | need 469 | needle 470 | nerve 471 | net 472 | new 473 | news 474 | night 475 | no 476 | noise 477 | normal 478 | north 479 | nose 480 | not 481 | note 482 | now 483 | number 484 | nut 485 | observation 486 | of 487 | off 488 | offer 489 | office 490 | oil 491 | old 492 | on 493 | only 494 | open 495 | operation 496 | opinion 497 | opposite 498 | or 499 | orange 500 | order 501 | organization 502 | ornament 503 | other 504 | out 505 | oven 506 | over 507 | owner 508 | page 509 | pain 510 | paint 511 | paper 512 | parallel 513 | parcel 514 | part 515 | past 516 | paste 517 | payment 518 | peace 519 | pen 520 | pencil 521 | person 522 | physical 523 | picture 524 | pig 525 | pin 526 | pipe 527 | place 528 | plane 529 | plant 530 | plate 531 | play 532 | please 533 | pleasure 534 | plough 535 | pocket 536 | point 537 | poison 538 | polish 539 | political 540 | poor 541 | porter 542 | position 543 | possible 544 | pot 545 | potato 546 | powder 547 | power 548 | present 549 | price 550 | print 551 | prison 552 | private 553 | probable 554 | process 555 | produce 556 | profit 557 | property 558 | prose 559 | protest 560 | public 561 | pull 562 | pump 563 | punishment 564 | purpose 565 | push 566 | put 567 | quality 568 | question 569 | quick 570 | quiet 571 | quite 572 | rail 573 | rain 574 | range 575 | rat 576 | rate 577 | ray 578 | reaction 579 | reading 580 | ready 581 | reason 582 | receipt 583 | record 584 | red 585 | regret 586 | regular 587 | relation 588 | religion 589 | representative 590 | request 591 | respect 592 | responsible 593 | rest 594 | reward 595 | rhythm 596 | rice 597 | right 598 | ring 599 | river 600 | road 601 | rod 602 | roll 603 | roof 604 | room 605 | root 606 | rough 607 | round 608 | rub 609 | rule 610 | run 611 | sad 612 | safe 613 | sail 614 | salt 615 | same 616 | sand 617 | say 618 | scale 619 | school 620 | science 621 | scissors 622 | screw 623 | sea 624 | seat 625 | second 626 | secret 627 | secretary 628 | see 629 | seed 630 | seem 631 | selection 632 | self 633 | send 634 | sense 635 | separate 636 | serious 637 | servant 638 | sex 639 | shade 640 | shake 641 | shame 642 | sharp 643 | sheep 644 | shelf 645 | ship 646 | shirt 647 | shock 648 | shoe 649 | short 650 | shut 651 | side 652 | sign 653 | silk 654 | silver 655 | simple 656 | sister 657 | size 658 | skin 659 | 660 | skirt 661 | sky 662 | sleep 663 | slip 664 | slope 665 | slow 666 | small 667 | smash 668 | smell 669 | smile 670 | smoke 671 | smooth 672 | snake 673 | sneeze 674 | snow 675 | so 676 | soap 677 | society 678 | sock 679 | soft 680 | solid 681 | some 682 | 683 | son 684 | song 685 | sort 686 | sound 687 | soup 688 | south 689 | space 690 | spade 691 | special 692 | sponge 693 | spoon 694 | spring 695 | square 696 | stage 697 | stamp 698 | star 699 | start 700 | statement 701 | station 702 | steam 703 | steel 704 | stem 705 | step 706 | stick 707 | sticky 708 | stiff 709 | still 710 | stitch 711 | stocking 712 | stomach 713 | stone 714 | stop 715 | store 716 | story 717 | straight 718 | strange 719 | street 720 | stretch 721 | strong 722 | structure 723 | substance 724 | such 725 | sudden 726 | sugar 727 | suggestion 728 | summer 729 | sun 730 | support 731 | surprise 732 | sweet 733 | swim 734 | system 735 | table 736 | tail 737 | take 738 | talk 739 | tall 740 | taste 741 | tax 742 | teaching 743 | tendency 744 | test 745 | than 746 | that 747 | the 748 | then 749 | theory 750 | there 751 | thick 752 | thin 753 | thing 754 | this 755 | thought 756 | thread 757 | throat 758 | through 759 | through 760 | thumb 761 | thunder 762 | ticket 763 | tight 764 | till 765 | time 766 | tin 767 | tired 768 | to 769 | toe 770 | together 771 | tomorrow 772 | tongue 773 | tooth 774 | top 775 | touch 776 | town 777 | trade 778 | train 779 | transport 780 | tray 781 | tree 782 | trick 783 | trouble 784 | trousers 785 | true 786 | turn 787 | twist 788 | umbrella 789 | under 790 | unit 791 | up 792 | use 793 | value 794 | verse 795 | very 796 | vessel 797 | view 798 | violent 799 | voice 800 | waiting 801 | walk 802 | wall 803 | war 804 | warm 805 | wash 806 | waste 807 | watch 808 | water 809 | wave 810 | wax 811 | way 812 | weather 813 | week 814 | weight 815 | well 816 | west 817 | wet 818 | wheel 819 | when 820 | where 821 | while 822 | whip 823 | whistle 824 | white 825 | who 826 | why 827 | wide 828 | will 829 | wind 830 | window 831 | wine 832 | wing 833 | winter 834 | wire 835 | wise 836 | with 837 | woman 838 | wood 839 | wool 840 | word 841 | work 842 | worm 843 | wound 844 | writing 845 | wrong 846 | year 847 | yellow 848 | yes 849 | yesterday 850 | you 851 | young 852 | Bernhard 853 | Breytenbach 854 | Android -------------------------------------------------------------------------------- /number_guessing.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | def get_random_number(): 4 | random_number = random.randint(0, 9) 5 | return random_number 6 | 7 | print("===== Welcome to Number Guessing Game =====") 8 | chances = 0 9 | while 1: 10 | choice = input("Do you wanna play (y/n): ") 11 | if 'y' in choice.lower(): 12 | print("Generating random number between 0 and 9") 13 | random_number = get_random_number() 14 | while 1: 15 | chances += 1 16 | user_number = int(input("Enter the number you think it is: ")) 17 | if user_number > 9 or user_number < 0: 18 | print("Invalid input...please try again") 19 | else: 20 | if user_number == random_number: 21 | print("Conguratulation !!! You got the number in {0} chances\n".format(chances)) 22 | chances = 0 23 | break 24 | elif user_number > random_number: 25 | if abs(user_number - random_number) <= 4: 26 | print("Close but not cigar, try a lower number") 27 | else: 28 | print("Not even close, try a lower number") 29 | elif user_number < random_number: 30 | if abs(user_number - random_number) <= 4: 31 | print("Close but not cigar, try a higher number") 32 | else: 33 | print("Not even close, try a higher number") 34 | elif 'n' in choice.lower(): 35 | print("Exiting...") 36 | break 37 | else: 38 | print("Invalid input...please try again") -------------------------------------------------------------------------------- /password_strength_checker.py: -------------------------------------------------------------------------------- 1 | import string 2 | import getpass 3 | 4 | def check_password_strength(password): 5 | lower_alpha_count = upper_alpha_count = number_count = whitespace_count = special_char_count = 0 6 | for char in list(password): 7 | if char in string.ascii_lowercase: 8 | lower_alpha_count += 1 9 | elif char in string.ascii_uppercase: 10 | upper_alpha_count += 1 11 | elif char in string.digits: 12 | number_count += 1 13 | elif char == ' ': 14 | whitespace_count += 1 15 | else: 16 | special_char_count += 1 17 | strength = 0 18 | remarks = '' 19 | 20 | if lower_alpha_count >= 1: 21 | strength += 1 22 | if upper_alpha_count >= 1: 23 | strength += 1 24 | if number_count >= 1: 25 | strength += 1 26 | if whitespace_count >= 1: 27 | strength += 1 28 | if special_char_count >= 1: 29 | strength += 1 30 | 31 | if strength == 1: 32 | remarks = "That's a very bad password. Change it as soon as possible." 33 | elif strength == 2: 34 | remarks = "That's not a good password. You should consider making a tougher password." 35 | elif strength == 3: 36 | remarks = "Your password is okay, but it can be improved a lot" 37 | elif strength == 4: 38 | remarks = "Your password is hard to guess. But you can make it even more secure" 39 | elif strength == 5: 40 | remarks = "Now that's one hell of a strong password !!! Hackers don't have a chance guessing that password." 41 | 42 | print("Your password has:-") 43 | print(f"{lower_alpha_count} lowercase letters") 44 | print(f"{upper_alpha_count} uppercase letters") 45 | print(f"{number_count} digits") 46 | print(f'{whitespace_count} whitespaces') 47 | print(f"{special_char_count} special characters") 48 | print(f"Password score: {strength}/5") 49 | print(f"Remarks: {remarks}") 50 | 51 | print("===== Welcome to Password Strength Checker =====") 52 | while 1: 53 | choice = input("Do you want to check a password's strength (y/n) : ") 54 | if 'y' in choice.lower(): 55 | password = getpass.getpass("Enter the password: ") 56 | check_password_strength(password) 57 | elif 'n' in choice.lower(): 58 | print('Exiting...') 59 | break 60 | else: 61 | print('Invalid input...please try again.') 62 | print() -------------------------------------------------------------------------------- /rock_paper_scissor.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | ROCK = 'rock' 4 | PAPER = 'paper' 5 | SCISSOR = 'scissor' 6 | choices = [ROCK, PAPER, SCISSOR] 7 | positive = [[PAPER, ROCK], [SCISSOR, PAPER], [ROCK, SCISSOR]] 8 | negative = [[ROCK, PAPER], [PAPER, SCISSOR], [SCISSOR, ROCK]] 9 | 10 | def get_computer_move(): 11 | return random.choice(choices) 12 | 13 | def find_winner(user_move, computer_move): 14 | if [user_move, computer_move] in positive: 15 | return 1 16 | elif [user_move, computer_move] in negative: 17 | return -1 18 | return 0 19 | 20 | print("===== Welcome to Rock, Paper And Scissor Game =====") 21 | while True: 22 | choice = input("Do you wanna play (y/n): ").strip().lower() 23 | if choice == 'y': 24 | computer_move = get_computer_move() 25 | while True: 26 | move = input("Select a move ('r' for rock/'p' for paper/'s' for scissor): ").strip().lower() 27 | if move in ['r', 'p', 's']: 28 | user_move = {'r': ROCK, 'p': PAPER, 's': SCISSOR}[move] 29 | print(f"User Move: {user_move}") 30 | print(f"Computer's Move: {computer_move}") 31 | output = find_winner(user_move, computer_move) 32 | if output == 1: 33 | print("User Won !!!") 34 | elif output == -1: 35 | print("Computer Won !!!") 36 | else: 37 | print("It's a Tie !!!") 38 | break 39 | else: 40 | print("Invalid input...please try again") 41 | elif choice == 'n': 42 | print("Exiting... Thanks for playing!") 43 | break 44 | else: 45 | print("Invalid input...please try again") 46 | print() 47 | -------------------------------------------------------------------------------- /tic_tac_toe.py: -------------------------------------------------------------------------------- 1 | board = [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']] 2 | X = 'X' 3 | O = 'O' 4 | 5 | def displayBoard(): 6 | print(f" {board[0][0]} | {board[0][1]} | {board[0][2]}") 7 | print(" ----------") 8 | print(f" {board[1][0]} | {board[1][1]} | {board[1][2]}") 9 | print(" ----------") 10 | print(f" {board[2][0]} | {board[2][1]} | {board[2][2]}") 11 | 12 | def updateBoard(character, position): 13 | row = (position-1)//3 14 | column = (position-1)%3 15 | board[row][column] = character 16 | 17 | def check_win(): 18 | for i in range(3): 19 | if board[i][0] == board[i][1] == board[i][2]: 20 | return 1 21 | elif board[0][i] == board[1][i] == board[2][i]: 22 | return 1 23 | 24 | if board[0][2] == board[1][1] == board[2][0]: 25 | return 1 26 | elif board[0][0] == board[1][1] == board[2][2]: 27 | return 1 28 | return 0 29 | 30 | def check_position(position): 31 | row = (position-1)//3 32 | column = (position-1)%3 33 | if board[row][column] == X or board[row][column] == O: 34 | return 0 35 | return 1 36 | 37 | print("===== Welcome to Tic Tac Toe Game =====") 38 | counter = 0 39 | while 1: 40 | if counter % 2 == 0: 41 | displayBoard() 42 | while 1: 43 | choice = int(input(f"Player {(counter%2)+1}, enter your position ('{X}'): ")) 44 | if choice < 1 or choice > 9: 45 | print('Invalid input...please try again.') 46 | if check_position(choice): 47 | updateBoard(X, choice) 48 | if check_win(): 49 | print(f"Conguratulations !!! Player {(counter%2)+1} won !!!") 50 | exit(0) 51 | else: 52 | counter += 1 53 | break 54 | else: 55 | print(f"Position {choice} is already occupied. Choose another position.") 56 | if counter == 9: 57 | print("The match ended with a draw !!! Better luck next time") 58 | exit(0) 59 | else: 60 | displayBoard() 61 | while 1: 62 | choice = int(input(f"Player {(counter%2)+1}, enter your position ('{O}'): ")) 63 | if choice < 1 or choice > 9: 64 | print('Invalid input...please try again.') 65 | if check_position(choice): 66 | updateBoard(O, choice) 67 | if check_win(): 68 | print(f"Conguratulations !!! Player {(counter%2)+1} won !!!") 69 | exit(0) 70 | else: 71 | counter += 1 72 | break 73 | else: 74 | print(f"Position {choice} is already occupied. Choose another position.") 75 | print() -------------------------------------------------------------------------------- /user_management_system.py: -------------------------------------------------------------------------------- 1 | database = {'entries': []} 2 | 3 | SRNO = 'srno' 4 | NAME = 'name' 5 | AGE = 'age' 6 | GENDER = 'gender' 7 | OCCUPATION = 'occupation' 8 | 9 | def get_serial_no(): 10 | return len(database['entries']) + 1 11 | 12 | def add_entry(entry): 13 | entry = { 14 | 'srno': get_serial_no(), 15 | 'name': entry['name'], 16 | 'age': entry['age'], 17 | 'gender': entry['gender'], 18 | 'occupation': entry['occupation'] 19 | } 20 | database['entries'].append(entry) 21 | 22 | def check_entry_presence(value): 23 | for num, entry in enumerate(database['entries']): 24 | if entry[value[0]] == value[1]: 25 | return 1 26 | return 0 27 | 28 | def search_entry(value): 29 | for num, entry in enumerate(database['entries']): 30 | if entry[value[0]] == value[1]: 31 | return entry 32 | 33 | def update_entry(value, updated_entry): 34 | for num, entry in enumerate(database['entries']): 35 | if entry[value[0]] == value[1]: 36 | database['entries'][num] == updated_entry 37 | 38 | def delete_entry(value): 39 | for num, entry in enumerate(database['entries']): 40 | if entry[value[0]] == value[1]: 41 | database['entries'].remove(entry) 42 | 43 | def display_entry(entry): 44 | print(f"SRNO: {entry['srno']}") 45 | print(f"Name: {entry['name']}") 46 | print(f"Age: {entry['age']}") 47 | print(f"Gender: {entry['gender']}") 48 | print(f"Occupation: {entry['occupation']}\n") 49 | 50 | def display_all_entries(): 51 | for entry in database["entries"]: 52 | display_entry(entry) 53 | 54 | def select_entry_and_value(): 55 | value_type = '' 56 | value = '' 57 | while 1: 58 | print('Choose an entry based on which to search entries in database: ') 59 | print("1. srno") 60 | print("2. name") 61 | print("3. age") 62 | print("4. gender") 63 | print("5. occupation") 64 | choice = int(input("Enter your choice: ")) 65 | if choice < 1 or choice > 5: 66 | print("Invalid input...please try again") 67 | else: 68 | if choice == 1: 69 | value_type = SRNO 70 | value = input("Enter serial number to search: ") 71 | return (value_type, value) 72 | elif choice == 2: 73 | value_type = NAME 74 | value = input("Enter name to search: ") 75 | return (value_type, value) 76 | elif choice == 3: 77 | value_type = AGE 78 | value = input("Enter age to search: ") 79 | return (value_type, value) 80 | elif choice == 4: 81 | value_type = GENDER 82 | value = input("Enter gender to search: ") 83 | return (value_type, value) 84 | elif choice == 5: 85 | value_type = OCCUPATION 86 | value = input("Enter occupation to search: ") 87 | return (value_type, value) 88 | 89 | def get_entry_details(): 90 | output = {} 91 | output[NAME] = input("Enter name: ") 92 | output[AGE] = input("Enter age: ") 93 | output[GENDER] = input("Enter gender: ") 94 | output[OCCUPATION] = input("Enter occupation: ") 95 | return output 96 | 97 | print("===== Welcome To User Management System =====") 98 | while 1: 99 | print("\nWhat would you like to do:-") 100 | print("1. Add an entry") 101 | print("2. Update an entry") 102 | print("3. Delete an entry") 103 | print("4. Search an entry") 104 | print("5. Display all entries") 105 | print("6. Exit") 106 | choice = int(input("Enter your choice: ")) 107 | if choice > 7 or choice < 1: 108 | print("Invalid input...please try again") 109 | else: 110 | if choice == 1: 111 | print("Enter details for the new entry:-") 112 | entry = get_entry_details() 113 | add_entry(entry) 114 | print("Entry successfully created...") 115 | elif choice == 2: 116 | value = select_entry_and_value() 117 | print('Enter the details of the updated entry:-') 118 | entry = get_entry_details() 119 | update_entry(value, entry) 120 | print("Entry successfully updated...") 121 | elif choice == 3: 122 | value = select_entry_and_value() 123 | delete_entry(value) 124 | print("Entry successfully deleted...") 125 | elif choice == 4: 126 | value = select_entry_and_value() 127 | entry = search_entry(value) 128 | display_entry(entry) 129 | elif choice == 5: 130 | display_all_entries() 131 | elif choice == 6: 132 | print('Exiting') 133 | break -------------------------------------------------------------------------------- /value_converter.py: -------------------------------------------------------------------------------- 1 | def convert_temperature(): 2 | print("\nWhich conversion do you want to choose:-") 3 | print("1. Celsius to Faranheit") 4 | print("2. Faranheit to Celsius") 5 | choice = int(input("Enter your choice: ")) 6 | if choice == 1: 7 | temp = float(input("Enter temperature in celsius: ")) 8 | print(f"{temp} degree celsius is equal to {(temp*9/5)+32} degree faranheit.\n") 9 | elif choice == 2: 10 | temp = float(input("Enter temperature in faranheit: ")) 11 | print(f"{temp} degree faranheit is equal to {(temp-32)*5/9} degree celsius.\n") 12 | else: 13 | print("Invalid input...please try again\n") 14 | 15 | def convert_currency(): 16 | print("\nWhich conversion do you want to choose:-") 17 | print("1. Dollar to pound") 18 | print("2. Pound to Dollar") 19 | choice = int(input("Enter your choice: ")) 20 | if choice == 1: 21 | value = float(input("Enter currency in dollars: ")) 22 | print(f"{value} dollars in pounds will be {value*0.73}\n") 23 | elif choice == 2: 24 | value = float(input("Enter currency in pounds: ")) 25 | print(f"{value} pounds in dollars will be {value/0.73}\n") 26 | 27 | def convert_lengths(): 28 | print("\nWhich conversion do you want to choose:-") 29 | print("1. Centimeters to foot and inches") 30 | print("2. Foot and inches to centimeter") 31 | choice = int(input("Enter your choice: ")) 32 | if choice == 1: 33 | value = float(input("Enter length in cm: ")) 34 | inches = value/2.54 35 | feet = inches/12 36 | print(f"{value} centimeters in equal to {feet} feet and {inches} inch\n") 37 | elif choice == 2: 38 | feet = float(input("Enter length in feet: ")) 39 | inches = float(input("Enter length in inches: ")) 40 | length = (feet*12 + inches)*2.54 41 | print(f"{feet} feet and {inches} inches in centimeters will be {length}\n") 42 | 43 | print("===== Welcome to Value Converter =====") 44 | while 1: 45 | print("Which option would you like to choose:-") 46 | print("1. Convert temperature") 47 | print("2. Convert currency") 48 | print("3. Convert lengths") 49 | print("4. Exit") 50 | choice = int(input("Enter your choice: ")) 51 | if choice == 1: 52 | convert_temperature() 53 | elif choice == 2: 54 | convert_currency() 55 | elif choice == 3: 56 | convert_lengths() 57 | elif choice == 4: 58 | print('Exiting...') 59 | exit(0) --------------------------------------------------------------------------------