├── data.db ├── test.cpp ├── index.html ├── Recursion Visulaizer ├── git ├── fencedmesh.PNG ├── Meshimproved.PNG └── .recursionVisualizer.py.swp ├── binod.txt ├── insta_monitering ├── ipList.txt ├── con_file.py └── subpinsta.py ├── swapping of two numbers ├── Checker_game_by_dz ├── __init__.py ├── modules │ ├── __init__.py │ └── statics.py └── assets │ └── crown.png ├── AI Game └── Tic-Tac-Toe-AI │ └── tic tac ├── PongPong_Game ├── pong │ ├── __init__.py │ └── rectangle.py ├── requirements.txt └── pong_game_play.gif ├── image2pdf └── requirements.txt ├── Key_Binding ├── requirement.txt └── key_binding.py ├── dialogs ├── requirements.txt ├── README.md └── messagebox.py ├── Industrial_developed_hangman ├── tests │ ├── __init__.py │ └── test_hangman │ │ └── __init__.py ├── src │ └── hangman │ │ └── __init__.py ├── recorces │ └── img.png ├── pytest.ini ├── Makefile ├── README.md └── Data │ └── text_images.txt ├── Password Generator ├── requirements_new.txt └── requirements.txt ├── nasa_apod_with_requests ├── settings.py └── README.md ├── socket-programming ├── requirements.txt ├── README.md └── client.py ├── text-to-audio ├── requirements.txt ├── hello.txt ├── hello_world.mp3 ├── main.py └── text-file-to-audio.py ├── wiki └── requirements.txt ├── Assembler ├── requirements.txt ├── examples │ ├── klmn │ ├── code2.txt │ ├── test.txt │ ├── code4.txt │ ├── code.txt │ └── code3.txt └── README.md ├── BlackJack_game └── requirements.txt ├── CliYoutubeDownloader └── requirements.txt ├── Flappy Bird - created with tkinter ├── .gitignore ├── Images │ ├── bird.png │ ├── tube.png │ ├── title.png │ ├── background.png │ ├── exit_button.png │ ├── scoreboard.png │ ├── tube_mouth.png │ ├── start_button.png │ └── original_background.png └── README.md ├── ImageDownloader ├── requirements.txt └── img_downloader.py ├── PDF ├── requirements.txt ├── output.pdf └── images │ └── ss.png ├── python_codes ├── async_downloader └── requirements.txt ├── flappyBird_pygame ├── README.md └── images │ ├── bird.gif │ ├── ground.png │ ├── pipe.png │ ├── pipe_end.png │ ├── background.png │ ├── pipe_body.png │ ├── bird_wing_up.png │ └── bird_wing_down.png ├── insta_image_saving ├── driver │ ├── file │ └── driver.exe ├── output │ └── file ├── readme.txt └── instructions.txt ├── text_to_audio ├── requirements.txt ├── README.md ├── special_file.txt └── author_name_NC.txt ├── Emoji Dictionary ├── requirements.txt └── Images │ ├── 1.jpg │ ├── 2.jpg │ ├── 3.jpg │ ├── 4.jpg │ ├── 5.jpg │ ├── 6.jpg │ ├── 7.jpg │ ├── 8.jpg │ └── 9.jpg ├── QuestionAnswerVirtualAssistant └── requirements.txt ├── Snake_water_gun └── README.md ├── Turn your PDFs into audio books ├── requirements.txt └── audiobook_gen.py ├── nitkarshchourasia └── to_sort │ ├── django_projects │ └── ToDo_webapp │ │ ├── todo │ │ ├── __init__.py │ │ ├── migrations │ │ │ └── __init__.py │ │ ├── tests.py │ │ ├── admin.py │ │ ├── apps.py │ │ ├── forms.py │ │ └── models.py │ │ ├── todo_site │ │ ├── __init__.py │ │ ├── asgi.py │ │ └── wsgi.py │ │ ├── db.sqlite3 │ │ ├── ToDo_webapp_Screenshot_demo.png │ │ └── manage.py │ ├── pdf_to_docx_converter │ └── requirements.txt │ └── JARVIS_python_bot │ ├── requirements.txt │ ├── .vscode │ └── settings.json │ ├── features_to_add.py │ └── README.md ├── sample.xlsx ├── bankmanaging.db ├── environment.yml ├── img └── hand1.jpg ├── Cat ├── text_c.txt ├── text_a.txt └── text_b.txt ├── Downloaded Files Organizer ├── requirements.txt ├── browser_status.py ├── readme.md └── obs.py ├── dec_to_hex.py ├── floodfill └── demo.gif ├── mathfunctions ├── print hello world.py ├── Koch Curve ├── README.txt └── output_2.mp4 ├── Python_chatting_application └── README.md ├── game_of_life └── sample.gif ├── nodepad ├── bin │ ├── notepad.pyc │ └── notepad_support.pyc └── img │ └── screenshot.png ├── Hand-Motion-Detection └── requirements.txt ├── brickout-game ├── classDiagram.png └── README.md ├── importerror.txt ├── linear-algebra-python └── src │ └── lib.pyc ├── repo_website └── docs │ └── img │ └── favicon.ico ├── News_App ├── requirements.txt └── README.md ├── Youtube Downloader With GUI ├── photo.jpg ├── photo.png ├── youtube-ios-app.ico └── Screenshot (138).png ├── Compression_Analysis ├── example_image.jpg ├── orignal_image.png └── compressed_image.png ├── 1 File handle ├── File handle binary │ ├── class.dat │ ├── studrec.dat │ ├── Deleting record in a binary file.py │ ├── search record in binary file.py │ ├── File handle binary read (record in non list form).py │ ├── Update a binary file.py │ └── Update a binary file2.py └── File handle text │ ├── story.txt │ ├── special symbol after word.py │ ├── happy.txt │ ├── input,output and error streams.py │ └── question 6.py ├── Droplistmenu └── README.md ├── oryx-build-commands.txt ├── ThirdAI └── Terms and Conditions │ └── XYZ product.pdf ├── recursive-fibonacci.py ├── positiveNegetive.py ├── ARKA.py ├── ASCIIvaluecharacter.py ├── pyhton_array.py ├── PRACTICEPROJECT-DISREGARD.txt ├── thired-party-haarcascade-mustache-on-face └── image │ ├── avee.png │ └── mustache.png ├── Face_Mask_detection (haarcascade) └── Resources │ └── keras_model.h5 ├── Randomnumber.py ├── Extract-Table-from-pdf-txt-docx └── Parent │ ├── Child1 │ ├── Pdf1_Child1.pdf │ ├── Pdf2_Child2.pdf │ ├── Document_Child1.docx │ └── Text_Child1.txt │ ├── Child2 │ ├── Pdf1_Child2.pdf │ ├── Pdf2_Child2.pdf │ ├── Document_Child2.docx │ └── Text_Child2.txt │ └── Child3 │ ├── Pdf1_Child3.pdf │ ├── Pdf2_Child3.pdf │ ├── Document_Child3.docx │ └── Text_Child3.txt ├── Number reverse.py ├── send_message_automation ├── README.md ├── automatic_send-message_demo_video.mp4 ├── send_message_automation_demo_video_2.mp4 ├── send_message_automation_demo_gif_image.gif └── author_name_NC.txt ├── how to add three numbers and find type in python.py ├── Generate a random number between 0 to 9.py ├── JARVIS ├── requirements.txt └── README.md ├── UI-Apps ├── README.md └── clock.py ├── new.py ├── convert celsius into fahrenheit.py ├── totaldigits.py ├── Decimal number to binary function.py ├── binary_search_trees ├── tree_node.py ├── inorder_successor.py ├── inorder_traversal.py ├── mirror_a_bst.py ├── search_in_bst.py ├── root_to_leaf_paths.py ├── insert_in_bst.py ├── validate_bst.py └── print_in_range.py ├── Colors ├── multicoloredline.py └── print_colors.py ├── Search_Engine ├── test_data.py └── README.md ├── iprint.py ├── vowel remover function.py ├── Automated Scheduled Call Reminders ├── requirements.txt └── schedular.py ├── qrcode.py ├── To find the largest number between 3 numbers.py ├── largestno.py ├── Wikipdedia ├── static │ └── js │ │ └── output.js └── main.py ├── date-timeclient.py ├── Windows_Wallpaper_Script ├── Wallpapers │ ├── desktop │ │ ├── 89d49683c75888287b50ccb05cab960b991231639dabe5bc817e1d9395a39694.jpg │ │ ├── acc15612b1c85619e06c584a52f6474242963dbb9fe315ec4ecd44de8f3702c8.jpg │ │ └── c1385a4022859c16bdf317e09668dbb3fc41a7e1c160605539abd1bcd29625af.jpg │ └── mobile │ │ ├── 5678c6685841ab637cfa63b8c0e32ee205649af2051eb75f40b00f4d5a42b7b9.jpg │ │ ├── a33845e422c7d1b668f60e53e942736c7bbc74299469b7df734254d28e026dc4.jpg │ │ └── e22f23869f500ee576cdc02fb83f911de31440d589e329d04576e571a54b8851.jpg └── ReadMe.md ├── cli_master └── database_import_countries.py ├── greattwono ├── simpleInterest.py ├── Random Password Generator.py ├── length.py ├── oneeven.py ├── Translator └── README.md ├── linear search.py ├── currency converter └── README.md ├── Sorting Algorithms ├── recursive-quick-sort.py ├── wave_sort.py ├── Count sort.py ├── Bubble_Sorting_Prog.py ├── SortingAStringAlphabetically.py ├── sorting.py ├── Sort the values of first list using second list.py ├── Linear_Insertion_Sort.py ├── Bubble_sort.py ├── insertion_sort.py ├── brickSort.py ├── pigeonhole_sort.py ├── selection_sort.py ├── selectionSort.py ├── stooge_sort.py └── Binary_Insertion_Sort.py ├── Kilometerstomile.py ├── PDFtoAudiobook.py ├── VoiceRepeater ├── readme.md └── __main__.py ├── missing number from list.py ├── Multiply.py ├── Electronics_Algorithms └── Ohms_law.py ├── mapit.py ├── factors.py ├── Fibonacci_sequence_recursive_sol.py ├── fibonacci_SIMPLIFIED ├── qrdecoder.py ├── Program of Reverse of any number.py ├── Python Program to Transpose a Matrix.py ├── decimal to binary.py ├── Armstrong_number ├── StringToBinary.py ├── cloning_a_list.py ├── python program for finding square root for positive number.py ├── different model output ├── letter_frequency.py ├── power_of_two.py ├── replacetext.py ├── Program to print table of given number.py ├── linear_search.py ├── pythagoreanTriplets.py ├── repeat.py ├── tuple.py ├── Patterns ├── pattern5.py ├── pattern6.py ├── pattern2.py └── patterns.py ├── QR_code_generator └── qrcode.py ├── powers of 2.py ├── text to speech ├── Python Distance.py ├── Unit Digit of a raised to power b.py ├── MySQL_Databses.py ├── gcd.py ├── check if a number positive , negative or zero ├── avg_xdspam_confidence.py ├── reversed_pattern3.py ├── url_shortner.py ├── Python Program to Display Fibonacci Sequence Using Recursion.py ├── Web Socket.py ├── generate_permutations.py ├── Encryption using base64.py ├── Python_swapping.py ├── String_Palindrome.py ├── VoiceAssistant └── Project_Basic_struct │ ├── TextTospeech.py │ └── speechtotext.py ├── XORcipher └── README.md ├── date-timeserver.py ├── Differentiate_List.py ├── friday.py ├── Palindrome_Checker.py ├── FibonacciNumbersWithGenerators.py ├── Python Program to Remove Punctuations from a String.py ├── index.py ├── Python Program for Tower of Hanoi.py ├── .gitignore ├── Crack_password.py ├── diamond.py ├── email id dictionary ├── README.md └── dict1.py ├── finding LCM.py ├── Python Program to Find LCM.py ├── count the numbers of two vovels.py ├── armstrongnumber.py ├── birthdays.py ├── triangles.py ├── Calculate resistance.py ├── AreaOfTriangle.py ├── Binary_to_Decimal.py ├── Python Program to Count the Number of Each Vowel.py ├── googlemaps.py ├── testlines.py ├── Turtle_Star.py ├── leap year.py ├── rotate_string.py ├── AREA OF TRIANGLE.py ├── fibonici series.py ├── to check leap year ├── Binary Coefficients.py ├── gambler.py ├── nDigitNumberCombinations.py ├── polygon.py ├── ultimate-phone-book └── readme.md ├── .github └── dependabot.yml ├── add_two_number.py ├── quote.py ├── video-operations ├── slow-motion.py └── timelapse.py ├── cricket_live_score.py ├── love_turtle.py ├── live_sketch.py ├── fetch_news.py ├── new_pattern.py ├── Dictionary opperations (input,update a dict).py ├── four_digit_num_combination.py ├── nslookup_check.py ├── FIND FACTORIAL OF A NUMBER.py ├── RandomDice.py ├── rotatelist.py ├── cartesian_product.py ├── password_checker.py ├── stone_paper_scissor └── utils.py ├── primelib └── Prime.txt ├── Python Program to Print the Fibonacci sequence.py ├── chaos.py ├── consonant.py ├── how to display the fibonacci sequence up to n-.py ├── next_number.py ├── greaterno.py ├── wikipedia.py ├── findlargestno.md ├── Shortest Distance between Two Lines.py ├── Python Program for Product of unique prime factors of a number.py ├── videodownloder.py ├── divisors_of_a_number.py ├── python_webscraper.py ├── string_rotation.py ├── Strings.py ├── chicks_n_rabs.py ├── Polyline.py ├── convert_wind_direction_to_degrees.py ├── longest_increasing_subsequence_length.py ├── create password validity in python.py ├── Image_resize.py ├── pyauto.py ├── FizzBuzz.py ├── LETTER GUESSER ├── bodymass.py ├── CountMillionCharacters-2.0.py ├── Email-Automation.py ├── Extract_Text_from_image.py ├── FindingResolutionOfAnImage.py ├── size(resolution)image.py ├── read_excel_file.py ├── SimpleStopWatch.py ├── List.py ├── Python Program to Merge Mails.py ├── Webbrowser └── tk-browser.py ├── sum_of_digits_of_a_number.py ├── two_num.py ├── binary search.py ├── Weather Scrapper └── weather.csv ├── ex20.py ├── num-py.py ├── slack_message.py ├── Battery_notifier.py ├── ReadFromCSV.py ├── add_two_nums.py ├── colorma_as_color.py ├── cricket_news.py ├── multiplication_table.py ├── check_internet_con.py ├── numberguessinggame └── index.py ├── spiralmatrix.py ├── convert_time.py ├── CountMillionCharacters-Variations └── variation1.py ├── XML └── HTML parsing ├── find_cube_root.py ├── internet_connection_py3.py ├── remove a character from a file and rewrite.py └── thread_signal.py /data.db: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test.cpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Recursion Visulaizer/git: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /binod.txt: -------------------------------------------------------------------------------- 1 | I am binod 2 | -------------------------------------------------------------------------------- /insta_monitering/ipList.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /swapping of two numbers: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Checker_game_by_dz/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /AI Game/Tic-Tac-Toe-AI/tic tac: -------------------------------------------------------------------------------- 1 | hii 2 | -------------------------------------------------------------------------------- /PongPong_Game/pong/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /image2pdf/requirements.txt: -------------------------------------------------------------------------------- 1 | pillow 2 | -------------------------------------------------------------------------------- /Key_Binding/requirement.txt: -------------------------------------------------------------------------------- 1 | quo>=2022.4 2 | -------------------------------------------------------------------------------- /dialogs/requirements.txt: -------------------------------------------------------------------------------- 1 | quo>=2022.4 2 | -------------------------------------------------------------------------------- /Industrial_developed_hangman/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Password Generator/requirements_new.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /PongPong_Game/requirements.txt: -------------------------------------------------------------------------------- 1 | pyglet==2.1.1 2 | -------------------------------------------------------------------------------- /nasa_apod_with_requests/settings.py: -------------------------------------------------------------------------------- 1 | key = "" 2 | -------------------------------------------------------------------------------- /socket-programming/requirements.txt: -------------------------------------------------------------------------------- 1 | socket 2 | -------------------------------------------------------------------------------- /text-to-audio/requirements.txt: -------------------------------------------------------------------------------- 1 | os 2 | gTTS 3 | -------------------------------------------------------------------------------- /wiki/requirements.txt: -------------------------------------------------------------------------------- 1 | wikipedia 2 | tkinter 3 | -------------------------------------------------------------------------------- /Assembler/requirements.txt: -------------------------------------------------------------------------------- 1 | print_function 2 | sys 3 | -------------------------------------------------------------------------------- /BlackJack_game/requirements.txt: -------------------------------------------------------------------------------- 1 | time 2 | random 3 | -------------------------------------------------------------------------------- /CliYoutubeDownloader/requirements.txt: -------------------------------------------------------------------------------- 1 | pytubefix 2 | -------------------------------------------------------------------------------- /Flappy Bird - created with tkinter/.gitignore: -------------------------------------------------------------------------------- 1 | Data -------------------------------------------------------------------------------- /ImageDownloader/requirements.txt: -------------------------------------------------------------------------------- 1 | requests==2.32.3 2 | -------------------------------------------------------------------------------- /Industrial_developed_hangman/src/hangman/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PDF/requirements.txt: -------------------------------------------------------------------------------- 1 | Pillow==11.1.0 2 | fpdf==1.7.2 -------------------------------------------------------------------------------- /python_codes: -------------------------------------------------------------------------------- 1 | python_codes 2 | print("Python") 3 | -------------------------------------------------------------------------------- /async_downloader/requirements.txt: -------------------------------------------------------------------------------- 1 | aiohttp==3.11.11 2 | -------------------------------------------------------------------------------- /flappyBird_pygame/README.md: -------------------------------------------------------------------------------- 1 | Flappy Bird Game in Python 2 | -------------------------------------------------------------------------------- /Industrial_developed_hangman/tests/test_hangman/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /insta_image_saving/driver/file: -------------------------------------------------------------------------------- 1 | this is the chrome driver folder. 2 | -------------------------------------------------------------------------------- /text_to_audio/requirements.txt: -------------------------------------------------------------------------------- 1 | gTTS==2.5.4 2 | pygame==2.6.1 3 | -------------------------------------------------------------------------------- /Assembler/examples/klmn: -------------------------------------------------------------------------------- 1 | Assembler/examples/code2.txt 2 | hello world 3 | -------------------------------------------------------------------------------- /Emoji Dictionary/requirements.txt: -------------------------------------------------------------------------------- 1 | tkinter 2 | messagebox 3 | emoji 4 | -------------------------------------------------------------------------------- /Password Generator/requirements.txt: -------------------------------------------------------------------------------- 1 | colorama==0.4.6 2 | inquirer==3.4.0 -------------------------------------------------------------------------------- /QuestionAnswerVirtualAssistant/requirements.txt: -------------------------------------------------------------------------------- 1 | pandas 2 | scikit-learn -------------------------------------------------------------------------------- /Snake_water_gun/README.md: -------------------------------------------------------------------------------- 1 | # Snake_water_gun 2 | Snake Water Gun game 3 | -------------------------------------------------------------------------------- /Turn your PDFs into audio books/requirements.txt: -------------------------------------------------------------------------------- 1 | PyPDF2 2 | pyttsx3 3 | -------------------------------------------------------------------------------- /nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo_site/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /sample.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/sample.xlsx -------------------------------------------------------------------------------- /PDF/output.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/PDF/output.pdf -------------------------------------------------------------------------------- /bankmanaging.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/bankmanaging.db -------------------------------------------------------------------------------- /environment.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/environment.yml -------------------------------------------------------------------------------- /img/hand1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/img/hand1.jpg -------------------------------------------------------------------------------- /insta_image_saving/output/file: -------------------------------------------------------------------------------- 1 | this is the output folder for saving images. 2 | -------------------------------------------------------------------------------- /nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /text-to-audio/hello.txt: -------------------------------------------------------------------------------- 1 | Hello world, this audio was created using GTTS module. 2 | -------------------------------------------------------------------------------- /PDF/images/ss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/PDF/images/ss.png -------------------------------------------------------------------------------- /Cat/text_c.txt: -------------------------------------------------------------------------------- 1 | I am the beginning of yet another text file. 2 | 3 | Spam and eggs. 4 | -------------------------------------------------------------------------------- /Checker_game_by_dz/modules/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Auhtor : Dhruv B Kakadiya 3 | 4 | """ 5 | -------------------------------------------------------------------------------- /Downloaded Files Organizer/requirements.txt: -------------------------------------------------------------------------------- 1 | sys 2 | os 3 | time 4 | psutil 5 | watchdog 6 | -------------------------------------------------------------------------------- /dec_to_hex.py: -------------------------------------------------------------------------------- 1 | dec_num = input("Enter the decimal number\n") 2 | print(hex(int(dec_num))) 3 | -------------------------------------------------------------------------------- /floodfill/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/floodfill/demo.gif -------------------------------------------------------------------------------- /mathfunctions: -------------------------------------------------------------------------------- 1 | x = min(65, 90, 65) 2 | y = max(2, 8, 10) 3 | 4 | print(x) 5 | print(y) 6 | -------------------------------------------------------------------------------- /print hello world.py: -------------------------------------------------------------------------------- 1 | # This program prints Hello, world! 2 | 3 | print('Hello, world!') 4 | -------------------------------------------------------------------------------- /Koch Curve/README.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Koch Curve/README.txt -------------------------------------------------------------------------------- /Koch Curve/output_2.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Koch Curve/output_2.mp4 -------------------------------------------------------------------------------- /Python_chatting_application/README.md: -------------------------------------------------------------------------------- 1 | # Python_chat_App 2 | Simple chat application using python 3 | -------------------------------------------------------------------------------- /game_of_life/sample.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/game_of_life/sample.gif -------------------------------------------------------------------------------- /nodepad/bin/notepad.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/nodepad/bin/notepad.pyc -------------------------------------------------------------------------------- /Hand-Motion-Detection/requirements.txt: -------------------------------------------------------------------------------- 1 | numpy==2.2.2 2 | opencv_python==4.11.0.86 3 | mediapipe==0.10.20 4 | -------------------------------------------------------------------------------- /nodepad/img/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/nodepad/img/screenshot.png -------------------------------------------------------------------------------- /Emoji Dictionary/Images/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Emoji Dictionary/Images/1.jpg -------------------------------------------------------------------------------- /Emoji Dictionary/Images/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Emoji Dictionary/Images/2.jpg -------------------------------------------------------------------------------- /Emoji Dictionary/Images/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Emoji Dictionary/Images/3.jpg -------------------------------------------------------------------------------- /Emoji Dictionary/Images/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Emoji Dictionary/Images/4.jpg -------------------------------------------------------------------------------- /Emoji Dictionary/Images/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Emoji Dictionary/Images/5.jpg -------------------------------------------------------------------------------- /Emoji Dictionary/Images/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Emoji Dictionary/Images/6.jpg -------------------------------------------------------------------------------- /Emoji Dictionary/Images/7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Emoji Dictionary/Images/7.jpg -------------------------------------------------------------------------------- /Emoji Dictionary/Images/8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Emoji Dictionary/Images/8.jpg -------------------------------------------------------------------------------- /Emoji Dictionary/Images/9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Emoji Dictionary/Images/9.jpg -------------------------------------------------------------------------------- /brickout-game/classDiagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/brickout-game/classDiagram.png -------------------------------------------------------------------------------- /text-to-audio/hello_world.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/text-to-audio/hello_world.mp3 -------------------------------------------------------------------------------- /PongPong_Game/pong_game_play.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/PongPong_Game/pong_game_play.gif -------------------------------------------------------------------------------- /importerror.txt: -------------------------------------------------------------------------------- 1 | In a normal python: 2 | 3 | pip install pywin32 4 | In anaconda: 5 | 6 | conda install pywin32 7 | -------------------------------------------------------------------------------- /nodepad/bin/notepad_support.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/nodepad/bin/notepad_support.pyc -------------------------------------------------------------------------------- /Cat/text_a.txt: -------------------------------------------------------------------------------- 1 | Sample Text Here 2 | 3 | Lorem ipsum, dolor sit amet. 4 | Hello, 5 | World! 6 | 7 | ABCD 1234 8 | -------------------------------------------------------------------------------- /Checker_game_by_dz/assets/crown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Checker_game_by_dz/assets/crown.png -------------------------------------------------------------------------------- /Recursion Visulaizer/fencedmesh.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Recursion Visulaizer/fencedmesh.PNG -------------------------------------------------------------------------------- /flappyBird_pygame/images/bird.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/flappyBird_pygame/images/bird.gif -------------------------------------------------------------------------------- /flappyBird_pygame/images/ground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/flappyBird_pygame/images/ground.png -------------------------------------------------------------------------------- /flappyBird_pygame/images/pipe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/flappyBird_pygame/images/pipe.png -------------------------------------------------------------------------------- /linear-algebra-python/src/lib.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/linear-algebra-python/src/lib.pyc -------------------------------------------------------------------------------- /repo_website/docs/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/repo_website/docs/img/favicon.ico -------------------------------------------------------------------------------- /News_App/requirements.txt: -------------------------------------------------------------------------------- 1 | solara == 1.43.0 2 | Flask 3 | gunicorn ==23.0.0 4 | simple-websocket 5 | flask-sock 6 | yfinance -------------------------------------------------------------------------------- /Recursion Visulaizer/Meshimproved.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Recursion Visulaizer/Meshimproved.PNG -------------------------------------------------------------------------------- /Youtube Downloader With GUI/photo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Youtube Downloader With GUI/photo.jpg -------------------------------------------------------------------------------- /Youtube Downloader With GUI/photo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Youtube Downloader With GUI/photo.png -------------------------------------------------------------------------------- /flappyBird_pygame/images/pipe_end.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/flappyBird_pygame/images/pipe_end.png -------------------------------------------------------------------------------- /insta_image_saving/driver/driver.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/insta_image_saving/driver/driver.exe -------------------------------------------------------------------------------- /Compression_Analysis/example_image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Compression_Analysis/example_image.jpg -------------------------------------------------------------------------------- /Compression_Analysis/orignal_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Compression_Analysis/orignal_image.png -------------------------------------------------------------------------------- /flappyBird_pygame/images/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/flappyBird_pygame/images/background.png -------------------------------------------------------------------------------- /flappyBird_pygame/images/pipe_body.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/flappyBird_pygame/images/pipe_body.png -------------------------------------------------------------------------------- /1 File handle/File handle binary/class.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/1 File handle/File handle binary/class.dat -------------------------------------------------------------------------------- /Compression_Analysis/compressed_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Compression_Analysis/compressed_image.png -------------------------------------------------------------------------------- /Droplistmenu/README.md: -------------------------------------------------------------------------------- 1 | The code is to show using tkinter GUI to creat droplist and calender, and using .place() manage the positions. 2 | -------------------------------------------------------------------------------- /flappyBird_pygame/images/bird_wing_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/flappyBird_pygame/images/bird_wing_up.png -------------------------------------------------------------------------------- /oryx-build-commands.txt: -------------------------------------------------------------------------------- 1 | PlatformWithVersion=Python 2 | BuildCommands=conda env create --file environment.yml --prefix ./venv --quiet 3 | -------------------------------------------------------------------------------- /1 File handle/File handle binary/studrec.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/1 File handle/File handle binary/studrec.dat -------------------------------------------------------------------------------- /Industrial_developed_hangman/recorces/img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Industrial_developed_hangman/recorces/img.png -------------------------------------------------------------------------------- /ThirdAI/Terms and Conditions/XYZ product.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/ThirdAI/Terms and Conditions/XYZ product.pdf -------------------------------------------------------------------------------- /flappyBird_pygame/images/bird_wing_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/flappyBird_pygame/images/bird_wing_down.png -------------------------------------------------------------------------------- /nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /Youtube Downloader With GUI/youtube-ios-app.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Youtube Downloader With GUI/youtube-ios-app.ico -------------------------------------------------------------------------------- /nitkarshchourasia/to_sort/pdf_to_docx_converter/requirements.txt: -------------------------------------------------------------------------------- 1 | python-docx==0.8.11 2 | PyMuPDF==1.18.17 3 | pytesseract==0.3.8 4 | Pillow==8.4.0 -------------------------------------------------------------------------------- /recursive-fibonacci.py: -------------------------------------------------------------------------------- 1 | def fib(n): 2 | if n == 0 or n == 1: 3 | return n 4 | else: 5 | return fib(n - 1) + fib(n - 2) 6 | -------------------------------------------------------------------------------- /Assembler/examples/code2.txt: -------------------------------------------------------------------------------- 1 | $msg db "hello world" 2 | 3 | mov ecx, $msg 4 | mov eax, 4 5 | int 0x80 6 | mov eax, 1 7 | mov ebx, 0 8 | int 0x80 9 | -------------------------------------------------------------------------------- /Flappy Bird - created with tkinter/Images/bird.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Flappy Bird - created with tkinter/Images/bird.png -------------------------------------------------------------------------------- /Flappy Bird - created with tkinter/Images/tube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Flappy Bird - created with tkinter/Images/tube.png -------------------------------------------------------------------------------- /Recursion Visulaizer/.recursionVisualizer.py.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Recursion Visulaizer/.recursionVisualizer.py.swp -------------------------------------------------------------------------------- /Youtube Downloader With GUI/Screenshot (138).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Youtube Downloader With GUI/Screenshot (138).png -------------------------------------------------------------------------------- /insta_image_saving/readme.txt: -------------------------------------------------------------------------------- 1 | THIS A JUPYTER NOTEBOOK FILE THAT CAN SAVE ALL OR SOME IMAGES FROM A PUBLIC INSTAGRAM URL AS PER USER'S DIRECTIVES. 2 | -------------------------------------------------------------------------------- /positiveNegetive.py: -------------------------------------------------------------------------------- 1 | n = int(input("Enter number: ")) 2 | if n > 0: 3 | print("Number is positive") 4 | else: 5 | print("Number is negative") 6 | -------------------------------------------------------------------------------- /ARKA.py: -------------------------------------------------------------------------------- 1 | def sumOfSeries(n): 2 | x = n * (n + 1) / 2 3 | return (int)(x * x) 4 | 5 | 6 | # Driver Function 7 | n = 5 8 | print(sumOfSeries(n)) 9 | -------------------------------------------------------------------------------- /ASCIIvaluecharacter.py: -------------------------------------------------------------------------------- 1 | # Program to find the ASCII value of the given character 2 | 3 | c = "p" 4 | print("The ASCII value of '" + c + "' is", ord(c)) 5 | -------------------------------------------------------------------------------- /Flappy Bird - created with tkinter/Images/title.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Flappy Bird - created with tkinter/Images/title.png -------------------------------------------------------------------------------- /pyhton_array.py: -------------------------------------------------------------------------------- 1 | from array import * 2 | 3 | array1 = array("i", [10, 20, 30, 40, 50]) 4 | 5 | array1[2] = 80 6 | 7 | for x in array1: 8 | print(x) 9 | -------------------------------------------------------------------------------- /Cat/text_b.txt: -------------------------------------------------------------------------------- 1 | I am another sample text file. 2 | 3 | The knights who say ni! 4 | 5 | Lines 6 | of 7 | Text! 8 | This file does not end with a newline. -------------------------------------------------------------------------------- /Flappy Bird - created with tkinter/Images/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Flappy Bird - created with tkinter/Images/background.png -------------------------------------------------------------------------------- /Flappy Bird - created with tkinter/Images/exit_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Flappy Bird - created with tkinter/Images/exit_button.png -------------------------------------------------------------------------------- /Flappy Bird - created with tkinter/Images/scoreboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Flappy Bird - created with tkinter/Images/scoreboard.png -------------------------------------------------------------------------------- /Flappy Bird - created with tkinter/Images/tube_mouth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Flappy Bird - created with tkinter/Images/tube_mouth.png -------------------------------------------------------------------------------- /PRACTICEPROJECT-DISREGARD.txt: -------------------------------------------------------------------------------- 1 | This is practice for my first time using GitHub 2 | 3 | Please disregard as I'm getting used to using CLI and GitHub 4 | 5 | Thanks! 6 | -------------------------------------------------------------------------------- /thired-party-haarcascade-mustache-on-face/image/avee.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/thired-party-haarcascade-mustache-on-face/image/avee.png -------------------------------------------------------------------------------- /Assembler/examples/test.txt: -------------------------------------------------------------------------------- 1 | 2 | ; variables 3 | VAR1 db 56 4 | $var1 db 10 5 | 6 | mov ecx, VAR1 7 | mov ebx, $var1 8 | sub ecx, ebx 9 | mov eax, 4 10 | int 0x80 -------------------------------------------------------------------------------- /Face_Mask_detection (haarcascade)/Resources/keras_model.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Face_Mask_detection (haarcascade)/Resources/keras_model.h5 -------------------------------------------------------------------------------- /Flappy Bird - created with tkinter/Images/start_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Flappy Bird - created with tkinter/Images/start_button.png -------------------------------------------------------------------------------- /Randomnumber.py: -------------------------------------------------------------------------------- 1 | # Program to generate a random number between 0 and 9 2 | 3 | # importing the random module 4 | from random import randint 5 | 6 | print(randint(0,9)) 7 | -------------------------------------------------------------------------------- /thired-party-haarcascade-mustache-on-face/image/mustache.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/thired-party-haarcascade-mustache-on-face/image/mustache.png -------------------------------------------------------------------------------- /Extract-Table-from-pdf-txt-docx/Parent/Child1/Pdf1_Child1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Extract-Table-from-pdf-txt-docx/Parent/Child1/Pdf1_Child1.pdf -------------------------------------------------------------------------------- /Extract-Table-from-pdf-txt-docx/Parent/Child1/Pdf2_Child2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Extract-Table-from-pdf-txt-docx/Parent/Child1/Pdf2_Child2.pdf -------------------------------------------------------------------------------- /Extract-Table-from-pdf-txt-docx/Parent/Child2/Pdf1_Child2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Extract-Table-from-pdf-txt-docx/Parent/Child2/Pdf1_Child2.pdf -------------------------------------------------------------------------------- /Extract-Table-from-pdf-txt-docx/Parent/Child2/Pdf2_Child2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Extract-Table-from-pdf-txt-docx/Parent/Child2/Pdf2_Child2.pdf -------------------------------------------------------------------------------- /Extract-Table-from-pdf-txt-docx/Parent/Child3/Pdf1_Child3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Extract-Table-from-pdf-txt-docx/Parent/Child3/Pdf1_Child3.pdf -------------------------------------------------------------------------------- /Extract-Table-from-pdf-txt-docx/Parent/Child3/Pdf2_Child3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Extract-Table-from-pdf-txt-docx/Parent/Child3/Pdf2_Child3.pdf -------------------------------------------------------------------------------- /Number reverse.py: -------------------------------------------------------------------------------- 1 | n=int(input("Enter number: ")) 2 | rev=0 3 | while(n>0): 4 | dig=n%10 5 | rev=rev*10+dig 6 | n=n//10 7 | print("Reverse of the number:",rev) 8 | -------------------------------------------------------------------------------- /send_message_automation/README.md: -------------------------------------------------------------------------------- 1 | # Send message automation 2 | 3 | 4 | sources used: 5 | 6 | 7 | Gif image creation credit goes to: 8 | - ezgif.com used to make gif images. -------------------------------------------------------------------------------- /send_message_automation/automatic_send-message_demo_video.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/send_message_automation/automatic_send-message_demo_video.mp4 -------------------------------------------------------------------------------- /Flappy Bird - created with tkinter/Images/original_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Flappy Bird - created with tkinter/Images/original_background.png -------------------------------------------------------------------------------- /dialogs/README.md: -------------------------------------------------------------------------------- 1 | [Quo](https://pypi.org/project/quo) ships with a high level API for displaying dialog boxes to the user for informational purposes, or get input from the user. 2 | -------------------------------------------------------------------------------- /how to add three numbers and find type in python.py: -------------------------------------------------------------------------------- 1 | #python program for adding three no. 2 | x=45 3 | y=75 4 | z=25 5 | t=x+y+z 6 | print(t) 7 | #type of output 8 | print(type(t)) 9 | -------------------------------------------------------------------------------- /nitkarshchourasia/to_sort/django_projects/ToDo_webapp/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/nitkarshchourasia/to_sort/django_projects/ToDo_webapp/db.sqlite3 -------------------------------------------------------------------------------- /send_message_automation/send_message_automation_demo_video_2.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/send_message_automation/send_message_automation_demo_video_2.mp4 -------------------------------------------------------------------------------- /Extract-Table-from-pdf-txt-docx/Parent/Child1/Document_Child1.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Extract-Table-from-pdf-txt-docx/Parent/Child1/Document_Child1.docx -------------------------------------------------------------------------------- /Extract-Table-from-pdf-txt-docx/Parent/Child2/Document_Child2.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Extract-Table-from-pdf-txt-docx/Parent/Child2/Document_Child2.docx -------------------------------------------------------------------------------- /Extract-Table-from-pdf-txt-docx/Parent/Child3/Document_Child3.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Extract-Table-from-pdf-txt-docx/Parent/Child3/Document_Child3.docx -------------------------------------------------------------------------------- /send_message_automation/send_message_automation_demo_gif_image.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/send_message_automation/send_message_automation_demo_gif_image.gif -------------------------------------------------------------------------------- /Generate a random number between 0 to 9.py: -------------------------------------------------------------------------------- 1 | # Program to generate a random number between 0 and 9 2 | 3 | # importing the random module 4 | import random 5 | 6 | print(random.randint(0,9)) 7 | -------------------------------------------------------------------------------- /JARVIS/requirements.txt: -------------------------------------------------------------------------------- 1 | datetime 2 | pyjokes 3 | requests 4 | Pillow 5 | Image 6 | ImageGrab 7 | gTTS 8 | keyboard 9 | key 10 | playsound 11 | pyttsx3 12 | SpeechRecognition 13 | openai -------------------------------------------------------------------------------- /UI-Apps/README.md: -------------------------------------------------------------------------------- 1 | ### SIMPLE CLOCK WIDGET USING TKINTER 2 | 3 | ## Running instruction 4 | 5 | # windows user 6 | run `py clock.py` 7 | 8 | # linux user 9 | run `python3 clock.py` -------------------------------------------------------------------------------- /new.py: -------------------------------------------------------------------------------- 1 | def hello_world(): 2 | """ 3 | Prints a greeting message. 4 | """ 5 | print("Hello, world!") 6 | 7 | 8 | if __name__ == "__main__": 9 | hello_world() 10 | -------------------------------------------------------------------------------- /convert celsius into fahrenheit.py: -------------------------------------------------------------------------------- 1 | cels= float(input("enter temp in celsius")) 2 | print("temprature in celsius is :",cels) 3 | fahr = cels*9/5+32 4 | print("temprature in fahrenhite is :",fahr) 5 | -------------------------------------------------------------------------------- /totaldigits.py: -------------------------------------------------------------------------------- 1 | # To Find The Total Number Of Digits In A Number 2 | 3 | N = int(input("Enter The number")) # To remove zeros before the number 4 | count = len(str(N)) 5 | 6 | print(count) 7 | -------------------------------------------------------------------------------- /1 File handle/File handle text/story.txt: -------------------------------------------------------------------------------- 1 | once upon a time there was a king. 2 | he was powerful and happy. 3 | he 4 | all the flowers in his garden were beautiful. 5 | he lived happily ever after. -------------------------------------------------------------------------------- /Decimal number to binary function.py: -------------------------------------------------------------------------------- 1 | # decimal number 2 | number = int(input("Enter any decimal number: ")) 3 | 4 | # print equivalent binary number 5 | print("Equivalent Binary Number: ", bin(number)) 6 | -------------------------------------------------------------------------------- /Extract-Table-from-pdf-txt-docx/Parent/Child1/Text_Child1.txt: -------------------------------------------------------------------------------- 1 | AB,DF,G,DF,SDF,ADA,QW,WE,ER,FD 2,45,56,7,8,9,65,3,5436,78 12,34,345,667,56,5657,768,45,46,67 67,89,8,9,89,8,78,9,67,67 1,23,4,5,65,76,8,6,45,67 -------------------------------------------------------------------------------- /insta_monitering/con_file.py: -------------------------------------------------------------------------------- 1 | host = "localhost" 2 | mongoPort = 27017 3 | SOCKS5_PROXY_PORT = 1080 4 | auth = "" 5 | passcode = "" 6 | 7 | # if proxy is not working please update the auth and passcode 8 | -------------------------------------------------------------------------------- /nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import Todo 3 | 4 | # Register your models here. 5 | 6 | admin.site.register(Todo) 7 | -------------------------------------------------------------------------------- /binary_search_trees/tree_node.py: -------------------------------------------------------------------------------- 1 | 2 | # Node class for binary tree 3 | 4 | class Node: 5 | def __init__(self, data): 6 | self.data = data 7 | self.left = None 8 | self.right = None 9 | -------------------------------------------------------------------------------- /Industrial_developed_hangman/pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | markers = 3 | internet_required: marks tests that requires internet connection (deselect with '-m "not internet_required"') 4 | serial 5 | timeout = 20 6 | -------------------------------------------------------------------------------- /Colors/multicoloredline.py: -------------------------------------------------------------------------------- 1 | ## This script prints a multicolored line 2 | # quo can be installed using pip 3 | 4 | from quo.console import Console 5 | 6 | console = Console() 7 | 8 | console.rule(multiclored=True) 9 | -------------------------------------------------------------------------------- /Extract-Table-from-pdf-txt-docx/Parent/Child2/Text_Child2.txt: -------------------------------------------------------------------------------- 1 | AC,DXFC,GB,DCF,SCDF,BADA,QB,W,R,F,C 2,45,56,7,8,9,65,3,5436,78,34 12,34,345,667,56,5657,768,45,46,67,34 67,89,8,9,89,8,78,9,67,67,43 1,23,4,5,65,76,8,6,45,67,61 -------------------------------------------------------------------------------- /Extract-Table-from-pdf-txt-docx/Parent/Child3/Text_Child3.txt: -------------------------------------------------------------------------------- 1 | AF,FC,GFB,DW,SF,BA,Q,WS,RR,FR,CW 2,45,56,7,8,9,65,3,5436,78,34 12,34,345,667,56,5657,768,45,46,67,34 67,89,8,9,89,8,78,9,67,67,43 1,23,4,5,65,76,8,6,45,67,61 -------------------------------------------------------------------------------- /nitkarshchourasia/to_sort/django_projects/ToDo_webapp/ToDo_webapp_Screenshot_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/nitkarshchourasia/to_sort/django_projects/ToDo_webapp/ToDo_webapp_Screenshot_demo.png -------------------------------------------------------------------------------- /Assembler/examples/code4.txt: -------------------------------------------------------------------------------- 1 | mov eax, 8 2 | mov ebx, 2 3 | mul ebx 4 | mov ecx, eax 5 | mov eax, 4 6 | int 0x80 7 | 8 | mov eax, 8 9 | mov ebx, 2 10 | div ebx 11 | mov ecx, eax 12 | mov eax, 4 13 | int 0x80 14 | 15 | -------------------------------------------------------------------------------- /Search_Engine/test_data.py: -------------------------------------------------------------------------------- 1 | documents = [ 2 | "we should all strive to be happy", 3 | "happiness is all you need", 4 | "a cheerful heart is a happy one", 5 | "no way should we be sad" 6 | ] 7 | 8 | search = "happy" -------------------------------------------------------------------------------- /iprint.py: -------------------------------------------------------------------------------- 1 | from time import sleep 2 | 3 | txt = input("") 4 | 5 | ap = "" 6 | 7 | for let in range(len(txt) - 1): 8 | ap += txt[let] 9 | print(ap, end="\r") 10 | sleep(0.1) 11 | 12 | print(txt, end="") 13 | -------------------------------------------------------------------------------- /nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class TodoConfig(AppConfig): 5 | default_auto_field = "django.db.models.BigAutoField" 6 | name = "todo" 7 | -------------------------------------------------------------------------------- /vowel remover function.py: -------------------------------------------------------------------------------- 1 | def vowel_remover(text): 2 | string = "" 3 | for l in text: 4 | if l.lower() not in "aeiou": 5 | string += l 6 | return string 7 | print(vowel_remover("hello world!")) 8 | -------------------------------------------------------------------------------- /Automated Scheduled Call Reminders/requirements.txt: -------------------------------------------------------------------------------- 1 | BlockingScheduler 2 | search 3 | os 4 | time 5 | gmtime 6 | strftime 7 | Client 8 | twilio 9 | datetime 10 | timedelta 11 | credentials 12 | firestore 13 | initialize_app 14 | -------------------------------------------------------------------------------- /Key_Binding/key_binding.py: -------------------------------------------------------------------------------- 1 | from quo.keys import bind 2 | from quo.prompt import Prompt 3 | 4 | session = Prompt() 5 | 6 | @bind.add("ctrl-h") 7 | def _(event): 8 | print("Hello, World") 9 | 10 | session.prompt("") 11 | -------------------------------------------------------------------------------- /dialogs/messagebox.py: -------------------------------------------------------------------------------- 1 | # Use the MessageBox() function to display a simple message box. 2 | 3 | from quo.dialog import MessageBox 4 | 5 | MessageBox( 6 | title='Example dialog window', 7 | text='Do you want to continue?') 8 | -------------------------------------------------------------------------------- /nasa_apod_with_requests/README.md: -------------------------------------------------------------------------------- 1 | you need to get your key at https://api.nasa.gov/ and put it in settings.py as a string with the name of key 2 | 3 | it will save the image inside a folder named img inside the project folder 4 | have fun! -------------------------------------------------------------------------------- /nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from .models import Todo 3 | 4 | 5 | class TodoForm(forms.ModelForm): 6 | class Meta: 7 | model = Todo 8 | fields = "__all__" 9 | -------------------------------------------------------------------------------- /qrcode.py: -------------------------------------------------------------------------------- 1 | # importing Required Modules 2 | import qrcode 3 | 4 | # QR Code Generator 5 | query = input("Enter Content: ") # Enter Content 6 | code = qrcode.make(query) # Making the QR code 7 | code.save("qrcode.png") # Saving the QR code file 8 | -------------------------------------------------------------------------------- /To find the largest number between 3 numbers.py: -------------------------------------------------------------------------------- 1 | # Python program to find the largest number among the three input numbers 2 | 3 | a=[] 4 | for i in range(3): 5 | a.append(int(input())) 6 | print("The largest among three numbers is:",max(a)) 7 | 8 | -------------------------------------------------------------------------------- /PongPong_Game/pong/rectangle.py: -------------------------------------------------------------------------------- 1 | # ./PongPong/pong/rectangle.py 2 | 3 | import pyglet 4 | 5 | 6 | class RectangleObject(pyglet.shapes.Rectangle): 7 | def __init__(self, *args, **kwargs): 8 | super(RectangleObject, self).__init__(*args, **kwargs) 9 | -------------------------------------------------------------------------------- /nitkarshchourasia/to_sort/JARVIS_python_bot/requirements.txt: -------------------------------------------------------------------------------- 1 | datetime 2 | pyjokes 3 | requests 4 | Pillow 5 | Image 6 | ImageGrab 7 | gTTS 8 | keyboard 9 | key 10 | playsound 11 | pyttsx3 12 | SpeechRecognition 13 | openai 14 | pynput 15 | pyaudio 16 | -------------------------------------------------------------------------------- /largestno.py: -------------------------------------------------------------------------------- 1 | # Python Program to find Largest of two Numbers using if-else statements 2 | a = int(input("Enter the first number: ")) 3 | b = int(input("Enter the second number: ")) 4 | if(a >= b): 5 | print(a, "is greater") 6 | else: 7 | print(b, "is greater") 8 | -------------------------------------------------------------------------------- /Assembler/examples/code.txt: -------------------------------------------------------------------------------- 1 | ; begin program 2 | ; variable section 3 | $var1 db 56 4 | $var2 db 44 5 | mov ecx, $var1 6 | push ecx 7 | mov eax, 3 8 | int 0x80 9 | pop eax 10 | add ecx, ebx 11 | add ecx, eax 12 | mov eax, 4 13 | int 0x80 14 | 15 | 16 | -------------------------------------------------------------------------------- /Wikipdedia/static/js/output.js: -------------------------------------------------------------------------------- 1 | function validateForm() { 2 | var language = document.getElementById("language").value; 3 | 4 | if (language === "Select") { 5 | alert("Please select a language."); 6 | return false; 7 | } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /date-timeclient.py: -------------------------------------------------------------------------------- 1 | import socket 2 | 3 | soc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 4 | soc.connect((socket.gethostname(), 2905)) 5 | recmsg = soc.recv(1024) 6 | soc.close() 7 | print("The time got from the server is %s" % recmsg.decode("ascii")) 8 | -------------------------------------------------------------------------------- /Windows_Wallpaper_Script/Wallpapers/desktop/89d49683c75888287b50ccb05cab960b991231639dabe5bc817e1d9395a39694.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Windows_Wallpaper_Script/Wallpapers/desktop/89d49683c75888287b50ccb05cab960b991231639dabe5bc817e1d9395a39694.jpg -------------------------------------------------------------------------------- /Windows_Wallpaper_Script/Wallpapers/desktop/acc15612b1c85619e06c584a52f6474242963dbb9fe315ec4ecd44de8f3702c8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Windows_Wallpaper_Script/Wallpapers/desktop/acc15612b1c85619e06c584a52f6474242963dbb9fe315ec4ecd44de8f3702c8.jpg -------------------------------------------------------------------------------- /Windows_Wallpaper_Script/Wallpapers/desktop/c1385a4022859c16bdf317e09668dbb3fc41a7e1c160605539abd1bcd29625af.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Windows_Wallpaper_Script/Wallpapers/desktop/c1385a4022859c16bdf317e09668dbb3fc41a7e1c160605539abd1bcd29625af.jpg -------------------------------------------------------------------------------- /Windows_Wallpaper_Script/Wallpapers/mobile/5678c6685841ab637cfa63b8c0e32ee205649af2051eb75f40b00f4d5a42b7b9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Windows_Wallpaper_Script/Wallpapers/mobile/5678c6685841ab637cfa63b8c0e32ee205649af2051eb75f40b00f4d5a42b7b9.jpg -------------------------------------------------------------------------------- /Windows_Wallpaper_Script/Wallpapers/mobile/a33845e422c7d1b668f60e53e942736c7bbc74299469b7df734254d28e026dc4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Windows_Wallpaper_Script/Wallpapers/mobile/a33845e422c7d1b668f60e53e942736c7bbc74299469b7df734254d28e026dc4.jpg -------------------------------------------------------------------------------- /Windows_Wallpaper_Script/Wallpapers/mobile/e22f23869f500ee576cdc02fb83f911de31440d589e329d04576e571a54b8851.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mysha85785/Python/HEAD/Windows_Wallpaper_Script/Wallpapers/mobile/e22f23869f500ee576cdc02fb83f911de31440d589e329d04576e571a54b8851.jpg -------------------------------------------------------------------------------- /cli_master/database_import_countries.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | url = "https://api.countrystatecity.in/v1/countries" 4 | 5 | headers = {"X-CSCAPI-KEY": "API_KEY"} 6 | 7 | response = requests.request("GET", url, headers=headers) 8 | 9 | print(response.text) 10 | -------------------------------------------------------------------------------- /greattwono: -------------------------------------------------------------------------------- 1 | # Python Program to find the largest of two numbers using an arithmetic operator 2 | a = int(input("Enter the first number: ")) 3 | b = int(input("Enter the second number: ")) 4 | if(a - b > 0): 5 | print(a, "is greater") 6 | else: 7 | print(b, "is greater") 8 | -------------------------------------------------------------------------------- /simpleInterest.py: -------------------------------------------------------------------------------- 1 | principle = float(input("Enter the principle amount:")) 2 | time = int(input("Enter the time(years):")) 3 | rate = float(input("Enter the rate:")) 4 | simple_interest = (principle * time * rate) / 100 5 | print("The simple interest is:", simple_interest) 6 | -------------------------------------------------------------------------------- /Random Password Generator.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | low="abcdefghijklmnopqrstuvwxyz" 4 | upp="ABCDEFGHIJKLMNOPQRSTUVWXYZ" 5 | num="0123456789" 6 | sym="!@#$%^&*" 7 | 8 | all=low+upp+num+sym 9 | length=8 10 | password="".join(random.sample(all,length)) 11 | print(password) 12 | 13 | -------------------------------------------------------------------------------- /length.py: -------------------------------------------------------------------------------- 1 | # User inputs the string and it gets stored in variable str 2 | str = input("Enter a string: ") 3 | 4 | # counter variable to count the character in a string 5 | counter = 0 6 | for s in str: 7 | counter = counter + 1 8 | print("Length of the input string is:", counter) 9 | -------------------------------------------------------------------------------- /oneeven.py: -------------------------------------------------------------------------------- 1 | # Python Program to Print Even Numbers from 1 to N 2 | 3 | maximum = int(input(" Please Enter the Maximum Value : ")) 4 | 5 | number = 1 6 | 7 | while number <= maximum: 8 | if number % 2 == 0: 9 | print("{0}".format(number)) 10 | number = number + 1 11 | -------------------------------------------------------------------------------- /Translator/README.md: -------------------------------------------------------------------------------- 1 | # Python-Translator 2 | ## Overview 3 | 4 | This is a python script that uses translator module powered by Google and translates words from a language of user's choice to another language of user's choice. 5 | 6 | ## Author 7 | - [Manisha Gupta](https://manisha069.github.io/) 8 | -------------------------------------------------------------------------------- /linear search.py: -------------------------------------------------------------------------------- 1 | #Author : ShankRoy 2 | 3 | def linearsearch(arr, x): 4 | for i in range(len(arr)): 5 | if arr[i] == x: 6 | return i 7 | return -1 8 | arr = ['t','u','t','o','r','i','a','l'] 9 | x = 'a' 10 | print("element found at index "+str(linearsearch(arr,x))) 11 | -------------------------------------------------------------------------------- /currency converter/README.md: -------------------------------------------------------------------------------- 1 | # Currency-Calculator-Dynamic 2 | Currency calculator which will fetch the latest and tell you the exact. 3 | 4 | pip installations:- 5 | 6 | pip install bs4 7 | pip install requests 8 | pip install pyqt5 9 | 10 | thank you for using our currency calculator ! 11 | :) 12 | -------------------------------------------------------------------------------- /Industrial_developed_hangman/Makefile: -------------------------------------------------------------------------------- 1 | lint: 2 | poetry run isort src tests 3 | poetry run flake8 src tests 4 | poetry run mypy src 5 | poetry run mypy tests 6 | 7 | test: 8 | poetry run pytest 9 | 10 | build: 11 | python src/hangman/main.py 12 | install: 13 | pip install poetry 14 | poetry install -------------------------------------------------------------------------------- /Sorting Algorithms/recursive-quick-sort.py: -------------------------------------------------------------------------------- 1 | def quick_sort(l): 2 | if len(l) <= 1: 3 | return l 4 | else: 5 | return ( 6 | quick_sort([e for e in l[1:] if e <= l[0]]) 7 | + [l[0]] 8 | + quick_sort([e for e in l[1:] if e > l[0]]) 9 | ) 10 | -------------------------------------------------------------------------------- /Kilometerstomile.py: -------------------------------------------------------------------------------- 1 | # Taking kilometers input from the user 2 | kilometers = float(input("Enter value in kilometers: ")) 3 | 4 | # conversion factor 5 | conv_fac = 0.621371 6 | 7 | # calculate miles 8 | miles = kilometers * conv_fac 9 | print(f'{kilometers:.2f} kilometers is equal to {miles:.2f} miles') 10 | -------------------------------------------------------------------------------- /PDFtoAudiobook.py: -------------------------------------------------------------------------------- 1 | import pyttsx3 2 | import pyPDF2 3 | book = open('book.pdf','rb') 4 | pdfreader = pyPDF2.PdfFileReader(book) 5 | pages = pdfreader.numPages 6 | print(pages) 7 | speaker = pyttsx3.init() 8 | page= pdfreader.getpage(7) 9 | text = page.extractText() 10 | speaker.say(text) 11 | speaker.runAndWait() 12 | -------------------------------------------------------------------------------- /Sorting Algorithms/wave_sort.py: -------------------------------------------------------------------------------- 1 | def sortInWave(arr, n): 2 | arr.sort() 3 | for i in range(0, n - 1, 2): 4 | arr[i], arr[i + 1] = arr[i + 1], arr[i] 5 | 6 | 7 | arr = [] 8 | arr = input("Enter the arr") 9 | sortInWave(arr, len(arr)) 10 | for i in range(0, len(arr)): 11 | print(arr[i], " ") 12 | -------------------------------------------------------------------------------- /VoiceRepeater/readme.md: -------------------------------------------------------------------------------- 1 | # A simple Voice repeater. 2 | 3 | ### Run the code and speak something: It will repeat exactly what you said! 4 | 5 | ### It creates a folder, 6 | 7 | ### Stores your speech as a sound file, 8 | 9 | ### And plays it! 10 | 11 | ### Requirements: Python, SpeechRecognition and playsound 12 | -------------------------------------------------------------------------------- /missing number from list.py: -------------------------------------------------------------------------------- 1 | # program to find a missing number from a list. 2 | 3 | 4 | def missing_number(num_list): 5 | return sum(range(num_list[0], num_list[-1] + 1)) - sum(num_list) 6 | 7 | 8 | print(missing_number([1, 2, 3, 4, 6, 7, 8])) 9 | 10 | print(missing_number([10, 11, 12, 14, 15, 16, 17])) 11 | -------------------------------------------------------------------------------- /Multiply.py: -------------------------------------------------------------------------------- 1 | def product(a,b): 2 | if(a 1: 4 | address = " ".join(sys.argv[1:]) 5 | 6 | elif len(pyperclip.paste()) > 2: 7 | address = pyperclip.paste() 8 | else: 9 | address = input("enter your palce") 10 | webbrowser.open("https://www.google.com/maps/place/" + address) 11 | -------------------------------------------------------------------------------- /factors.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | print("The factors of the number you type when prompted will be displayed") 4 | a = int(input("Type now // ")) 5 | b = 1 6 | while b <= math.sqrt(a): 7 | if a % b == 0: 8 | print("A factor of the number is ", b) 9 | print("A factor of the number is ", int(a / b)) 10 | b += 1 11 | -------------------------------------------------------------------------------- /Fibonacci_sequence_recursive_sol.py: -------------------------------------------------------------------------------- 1 | def fib(term): 2 | if term <= 1: 3 | return term 4 | else: 5 | return fib(term - 1) + fib(term - 2) 6 | 7 | 8 | # Change this value to adjust the number of terms in the sequence. 9 | number_of_terms = int(input()) 10 | for i in range(number_of_terms): 11 | print(fib(i)) 12 | -------------------------------------------------------------------------------- /fibonacci_SIMPLIFIED: -------------------------------------------------------------------------------- 1 | 2 | #printing fibonnaci series till nth element - simplified version for begginers 3 | def print_fibonacci(n): 4 | current_no = 1 5 | prev_no = 0 6 | for i in range(n): 7 | print(current_no, end = " ") 8 | prev_no,current_no = current_no, current_no + prev_no 9 | 10 | print_fibonacci(10) 11 | -------------------------------------------------------------------------------- /qrdecoder.py: -------------------------------------------------------------------------------- 1 | # Importing Required Modules 2 | import cv2 3 | 4 | # QR Code Decoder 5 | 6 | filename = input() 7 | image = cv2.imread(filename) # Enter name of the image 8 | detector = cv2.QRCodeDetector() 9 | data, vertices_array, binary_qrcode = detector.detectAndDecode(image) 10 | if vertices_array is not None: 11 | print(data) 12 | -------------------------------------------------------------------------------- /Program of Reverse of any number.py: -------------------------------------------------------------------------------- 1 | num = int(input("enter any Number")) 2 | rev = 0 3 | while num > 0: 4 | Rem = num % 10 5 | num = num // 10 6 | rev = rev * 10 + Rem 7 | print("The Reverse of the number", rev) 8 | ################## 9 | # could also simply do this another way 10 | 11 | num = input() 12 | print(int(num[::-1])) 13 | -------------------------------------------------------------------------------- /Python Program to Transpose a Matrix.py: -------------------------------------------------------------------------------- 1 | X = [[12,7], 2 | [4 ,5], 3 | [3 ,8]] 4 | 5 | result = [[0,0,0], 6 | [0,0,0]] 7 | 8 | # iterate through rows 9 | for i in range(len(X)): 10 | # iterate through columns 11 | for j in range(len(X[0])): 12 | result[j][i] = X[i][j] 13 | 14 | for r in result: 15 | print(r) 16 | -------------------------------------------------------------------------------- /decimal to binary.py: -------------------------------------------------------------------------------- 1 | def decimalToBinary(num): 2 | """This function converts decimal number 3 | to binary and prints it""" 4 | if num > 1: 5 | decimalToBinary(num // 2) 6 | print(num % 2, end='') 7 | 8 | 9 | # decimal number 10 | number = int(input("Enter any decimal number: ")) 11 | 12 | decimalToBinary(number) 13 | -------------------------------------------------------------------------------- /Armstrong_number: -------------------------------------------------------------------------------- 1 | def is_armstrong_number(number): 2 | numberstr = str(number) 3 | length = len(numberstr) 4 | num = number 5 | rev = 0 6 | temp = 0 7 | while num != 0: 8 | rem = num % 10 9 | num //= 10 10 | temp += rem ** length 11 | return temp == number 12 | 13 | is_armstrong_number(5) 14 | -------------------------------------------------------------------------------- /Flappy Bird - created with tkinter/README.md: -------------------------------------------------------------------------------- 1 | # Description: 2 | This is a simple game created with tkinter.
3 | Enjoy and do give feedback
4 | Warning: If the game is too slow, lower the game resolution in Data/settings.json 5 | 6 | # Requirements: 7 | Tkinter 8 | ```bash 9 | pip install tkinter 10 | ``` 11 | PIL
12 | Python 3.x 13 | -------------------------------------------------------------------------------- /StringToBinary.py: -------------------------------------------------------------------------------- 1 | text = input("Enter Text : ") 2 | 3 | for chr in text: 4 | bin = "" 5 | asciiVal = int(ord(chr)) 6 | while asciiVal > 0: 7 | if asciiVal % 2 == 0: 8 | bin = bin + "0" 9 | else: 10 | bin = bin + "1" 11 | asciiVal = int(asciiVal / 2) 12 | print(bin + " : " + bin[::-1]) 13 | -------------------------------------------------------------------------------- /cloning_a_list.py: -------------------------------------------------------------------------------- 1 | # Python program to copy or clone a list 2 | # Using the Slice Operator 3 | def Cloning(li1): 4 | return li1[:] 5 | 6 | # Driver Code 7 | li1 = [ 8 | 4, 9 | 8, 10 | 2, 11 | 10, 12 | 15, 13 | 18 14 | ] 15 | li2 = Cloning(li1) 16 | print("Original List:", li1) 17 | print("After Cloning:", li2) 18 | -------------------------------------------------------------------------------- /python program for finding square root for positive number.py: -------------------------------------------------------------------------------- 1 | # Python Program to calculate the square root 2 | 3 | # Note: change this value for a different result 4 | num = 8 5 | 6 | # To take the input from the user 7 | #num = float(input('Enter a number: ')) 8 | 9 | num_sqrt = num ** 0.5 10 | print('The square root of %0.3f is %0.3f'%(num ,num_sqrt)) 11 | -------------------------------------------------------------------------------- /different model output: -------------------------------------------------------------------------------- 1 | Model Output 2 | 3 | Decision tree : 4 | Mean: 4.207225187158817 5 | Standard deviation: 0.8745567547159991 6 | 7 | linear Regression : 8 | Mean: 5.030437102767307 9 | Standard deviation: 1.0607661158294834 10 | 11 | Random forest regressor: 12 | Mean: 3.3009631251857217 13 | Standard deviation: 0.7076841067486248 -------------------------------------------------------------------------------- /letter_frequency.py: -------------------------------------------------------------------------------- 1 | # counting the number of occurrences of a letter in a string using defaultdict 2 | # left space in starting for clarity 3 | from collections import defaultdict 4 | 5 | s = "mississippi" 6 | d = defaultdict(int) 7 | for k in s: 8 | d[k] += 1 9 | sorted(d.items()) 10 | print(d) 11 | 12 | # OUTPUT --- [('i', 4), ('m', 1), ('p', 2), ('s', 4)] 13 | -------------------------------------------------------------------------------- /1 File handle/File handle text/special symbol after word.py: -------------------------------------------------------------------------------- 1 | with open("happy.txt", "r") as F: 2 | # method 1 3 | for i in F.read().split(): 4 | print(i, "*", end="") 5 | print("\n") 6 | 7 | # method 2 8 | F.seek(0) 9 | for line in F.readlines(): 10 | for word in line.split(): 11 | print(word, "*", end="") 12 | -------------------------------------------------------------------------------- /Assembler/examples/code3.txt: -------------------------------------------------------------------------------- 1 | 2 | mov ecx, 5 3 | call _double 4 | call _cube 5 | call _inc 6 | mov eax, 4 7 | int 0x80 8 | mov eax, 1 9 | mov ebx, 0 10 | int 0x80 11 | 12 | 13 | 14 | _double: 15 | add ecx, ecx 16 | ret 17 | 18 | _cube: 19 | push eax 20 | mov eax, ecx 21 | add ecx, eax 22 | add ecx, eax 23 | pop eax 24 | ret 25 | 26 | _inc: 27 | add ecx, 1 28 | ret 29 | -------------------------------------------------------------------------------- /power_of_two.py: -------------------------------------------------------------------------------- 1 | # Simple and efficient python program to check whether a number is series of power of two 2 | # Example: 3 | # Input: 4 | # 8 5 | # Output: 6 | # It comes in power series of 2 7 | a = int(input("Enter a number")) 8 | if a & (a - 1) == 0: 9 | print("It comes in power series of 2") 10 | else: 11 | print("It does not come in power series of 2") 12 | -------------------------------------------------------------------------------- /replacetext.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # program to replace all the spaces in an entered string with a hyphen"-" 4 | def replacetext(string): 5 | string = string.replace(" ", "-") 6 | return string 7 | 8 | 9 | S = input("Enter a text to replace all its spaces with hyphens: ") 10 | N = replacetext(S) 11 | print("The changed text is: ", N) 12 | -------------------------------------------------------------------------------- /text_to_audio/README.md: -------------------------------------------------------------------------------- 1 | Improvement: Nitkarsh Chourasia 2 | 3 | Improvement made: 4 | Used class 5 | implemented lazy loading 6 | optimised memory by selective importing of modules and it's methods 7 | uses effective exception handling 8 | tested on windows and linux 9 | gui is to be made 10 | Memory optimised 11 | PEP8 compliant 12 | linter friendly : -------------------------------------------------------------------------------- /Program to print table of given number.py: -------------------------------------------------------------------------------- 1 | n = int(input("Enter the number to print the tables for:")) 2 | for i in range(1, 11): 3 | print(n, "x", i, "=", n * i) 4 | 5 | # Example 6 | # input: 2 7 | # output: 8 | """ 9 | 2 x 1 = 2 10 | 2 x 2 = 4 11 | 2 x 3 = 6 12 | 2 x 4 = 8 13 | 2 x 5 = 10 14 | 2 x 6 = 12 15 | 2 x 7 = 14 16 | 2 x 8 = 16 17 | 2 x 9 = 18 18 | 2 x 10 = 20 19 | """ 20 | -------------------------------------------------------------------------------- /linear_search.py: -------------------------------------------------------------------------------- 1 | num = int(input("Enter size of list: \t")) 2 | list = [int(input("Enter any number: \t")) for _ in range(num)] 3 | 4 | x = int(input("\nEnter number to search: \t")) 5 | 6 | for position, number in enumerate(list): 7 | if number == x: 8 | print(f"\n{x} found at position {position}") 9 | else: 10 | print(f"list: {list}") 11 | print(f"{x} is not in list") -------------------------------------------------------------------------------- /pythagoreanTriplets.py: -------------------------------------------------------------------------------- 1 | limit = int(input("Enter upper limit:")) 2 | c = 0 3 | m = 2 4 | while c < limit: 5 | for n in range(1, m + 1): 6 | a = m * m - n * n 7 | b = 2 * m * n 8 | c = m * m + n * n 9 | if c > limit: 10 | break 11 | if a == 0 or b == 0 or c == 0: 12 | break 13 | print(a, b, c) 14 | m = m + 1 15 | -------------------------------------------------------------------------------- /Industrial_developed_hangman/README.md: -------------------------------------------------------------------------------- 1 | This is a simple game hangman 2 | 3 | to install dependencies got to repository "Industrial_developed_hangman" by `cd .\Industrial_developed_hangman\` and run `make install` 4 | 5 | to start it use `make build` command 6 | 7 | example of programm run: 8 | 9 | 10 | ![img.png](recorces/img.png) 11 | 12 | also makefile have lint command to lint source code -------------------------------------------------------------------------------- /repeat.py: -------------------------------------------------------------------------------- 1 | def Repeat(x): 2 | _size = len(x) 3 | repeated = [] 4 | for i in range(_size): 5 | k = i + 1 6 | for j in range(k, _size): 7 | if x[i] == x[j] and x[i] not in repeated: 8 | repeated.append(x[i]) 9 | return repeated 10 | 11 | 12 | list1 = [10, 20, 30, 20, 20, 30, 40, 50, -20, 60, 60, -20, -20] 13 | print(Repeat(list1)) 14 | -------------------------------------------------------------------------------- /tuple.py: -------------------------------------------------------------------------------- 1 | a=(1,2,3,4,5) 2 | print('Individual elements of Tuple are') 3 | for i in a: 4 | print(i,end=' ') 5 | print() 6 | print('Value at index number 3 is:',a[3]) 7 | print('Values from index no 2 are',a[2:]) 8 | print('Length of tuple is',len(a)) 9 | print('Maximum value from tuple is ',max(a)) 10 | print('Minimum value from tuple is ',min(a)) 11 | del a #delete the whole tuple 12 | -------------------------------------------------------------------------------- /1 File handle/File handle text/happy.txt: -------------------------------------------------------------------------------- 1 | hello how are you 2 | what is your name 3 | do not worry everything is alright 4 | everything will be alright 5 | please don't lose hope 6 | Wonders are on the way 7 | Take a walk in the park 8 | At the end of the day you are more important than anything else. 9 | Many moments of happiness are waiting 10 | You are amazing! 11 | If you truly believe. -------------------------------------------------------------------------------- /News_App/README.md: -------------------------------------------------------------------------------- 1 | ## News App 2 | 3 | - I have create News app using python solara framework and yfinace for getting news of stocks. 4 | 5 | Steps to run the app: 6 | 7 | 1. Clone the repositery and go to the `News_App` and Install all the requirements 8 | 9 | ``` 10 | pip install -r requirements.txt 11 | ``` 12 | 13 | 2. Run the solara app 14 | 15 | ``` 16 | solara run Newsapp.py 17 | ``` 18 | -------------------------------------------------------------------------------- /Patterns/pattern5.py: -------------------------------------------------------------------------------- 1 | #pattern Reverse piramid of numbers 2 | #1 3 | #21 4 | #321 5 | #4321 6 | #54321 7 | 8 | def main(): 9 | lines = int(input("Enter the number of lines: ")) 10 | pattern(lines) 11 | 12 | def pattern(rows): 13 | const='' 14 | for i in range(1, rows+1): 15 | const=str(i)+const 16 | print(const) 17 | 18 | if __name__ == "__main__": 19 | main() 20 | -------------------------------------------------------------------------------- /QR_code_generator/qrcode.py: -------------------------------------------------------------------------------- 1 | import pyqrcode, png 2 | # from pyqrcode import QRCode 3 | # no need to import same library again and again 4 | 5 | # Creating QR code after given text "input" 6 | url = pyqrcode.create(input("Enter text to convert: ")) 7 | # Saving QR code as a png file 8 | url.show() 9 | # Name of QR code png file "input" 10 | url.png(input("Enter image name to save: ") + ".png", scale=6) 11 | -------------------------------------------------------------------------------- /powers of 2.py: -------------------------------------------------------------------------------- 1 | # Display the powers of 2 using anonymous function 2 | 3 | terms = 10 4 | 5 | # Uncomment code below to take input from the user 6 | # terms = int(input("How many terms? ")) 7 | 8 | # use anonymous function 9 | result = list(map(lambda x: 2 ** x, range(terms))) 10 | 11 | print("The total terms are:",terms) 12 | for i in range(terms): 13 | print("2 raised to power",i,"is",result[i]) 14 | -------------------------------------------------------------------------------- /text to speech: -------------------------------------------------------------------------------- 1 | pip install gTTS 2 | #importing the gTTS library 3 | from gtts import gTTS 4 | #Asking the user for the required text 5 | mt = input("Enter the required text:\t") 6 | #Setting the output language 7 | language = ‘en’ 8 | #Converting text to speech and choosing speed as fast 9 | voice = gTTS(text=mt, lang=language, slow=False) 10 | #Saving the speech as mp3 file 11 | voice.save(“conv.mp3”) 12 | -------------------------------------------------------------------------------- /Python Distance.py: -------------------------------------------------------------------------------- 1 | # Display the powers of 2 using anonymous function 2 | 3 | terms = 10 4 | 5 | # Uncomment code below to take input from the user 6 | # terms = int(input("How many terms? ")) 7 | 8 | # use anonymous function 9 | result = list(map(lambda x: 2 ** x, range(terms))) 10 | 11 | print("The total terms are:",terms) 12 | for i in range(terms): 13 | print("2 raised to power",i,"is",result[i]) 14 | -------------------------------------------------------------------------------- /Unit Digit of a raised to power b.py: -------------------------------------------------------------------------------- 1 | def last_digit(a, b): 2 | if b == 0: # This Code assumes that 0^0 is 1 3 | return 1 4 | elif a % 10 in [0, 5, 6, 1]: 5 | return a % 10 6 | elif b % 4 == 0: 7 | return ((a % 10) ** 4) % 10 8 | else: 9 | return ((a % 10) ** (b % 4)) % 10 10 | 11 | 12 | # Courtesy to https://brilliant.org/wiki/finding-the-last-digit-of-a-power/ 13 | -------------------------------------------------------------------------------- /MySQL_Databses.py: -------------------------------------------------------------------------------- 1 | import mysql.connector 2 | 3 | # MySQl databses details 4 | 5 | mydb = mysql.connector.connect( 6 | host="0.0.0.0", user="root", passwd="", database="db_name" 7 | ) 8 | mycursor = mydb.cursor() 9 | 10 | # Execute SQL Query =>>>> mycursor.execute("SQL Query") 11 | mycursor.execute("SELECT column FROM table") 12 | 13 | myresult = mycursor.fetchall() 14 | 15 | for x in myresult: 16 | print(x) 17 | -------------------------------------------------------------------------------- /gcd.py: -------------------------------------------------------------------------------- 1 | """ 2 | although there is function to find gcd in python but this is the code which 3 | takes two inputs and prints gcd of the two. 4 | """ 5 | a = int(input("Enter number 1 (a): ")) 6 | b = int(input("Enter number 2 (b): ")) 7 | 8 | i = 1 9 | while i <= a and i <= b: 10 | if a % i == 0 and b % i == 0: 11 | gcd = i 12 | i = i + 1 13 | 14 | print("\nGCD of {0} and {1} = {2}".format(a, b, gcd)) 15 | -------------------------------------------------------------------------------- /nitkarshchourasia/to_sort/JARVIS_python_bot/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cSpell.words": [ 3 | "extention", 4 | "gtts", 5 | "initialisation", 6 | "mspaint", 7 | "myobj", 8 | "openai", 9 | "playsound", 10 | "pynput", 11 | "pyttsx", 12 | "stickynot", 13 | "Stiky", 14 | "stikynot", 15 | "takecommand", 16 | "whenver", 17 | "wishme", 18 | "yourr" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /Patterns/pattern6.py: -------------------------------------------------------------------------------- 1 | # Python code to print the following alphabet pattern 2 | #A 3 | #B B 4 | #C C C 5 | #D D D D 6 | #E E E E E 7 | def alphabetpattern(n): 8 | num = 65 9 | for i in range(0, n): 10 | for j in range(0, i+1): 11 | ch = chr(num) 12 | print(ch, end=" ") 13 | num = num + 1 14 | print("\r") 15 | 16 | a = 5 17 | alphabetpattern(a) 18 | -------------------------------------------------------------------------------- /check if a number positive , negative or zero: -------------------------------------------------------------------------------- 1 | num = float(input("Enter a number: ")) 2 | if num > 0: 3 | print("Positive number") 4 | elif num == 0: 5 | print("Zero") 6 | else: 7 | print("Negative number") 8 | num = float(input("Enter a number: ")) 9 | if num >= 0: 10 | if num == 0: 11 | print("Zero") 12 | else: 13 | print("Positive number") 14 | else: 15 | print("Negative number") 16 | 17 | -------------------------------------------------------------------------------- /avg_xdspam_confidence.py: -------------------------------------------------------------------------------- 1 | fh = open("mbox-short.txt") 2 | # The 'mbox-short.txt' file can be downloaded from the link: https://www.py4e.com/code3/mbox-short.txt 3 | sum = 0 4 | count = 0 5 | for fx in fh: 6 | fx = fx.rstrip() 7 | if not fx.startswith("X-DSPAM-Confidence:"): 8 | continue 9 | fy = fx[19:] 10 | count = count + 1 11 | sum = sum + float(fy) 12 | print("Average spam confidence: ", sum / count) 13 | -------------------------------------------------------------------------------- /reversed_pattern3.py: -------------------------------------------------------------------------------- 1 | #Simple inverted number triangle piramid 2 | #11111 3 | #2222 4 | #333 5 | #44 6 | #5 7 | 8 | def main(): 9 | lines = int(input("Enter no.of lines: ")) 10 | pattern(lines) 11 | 12 | def pattern(lines): 13 | t = 1 14 | for i in reversed(range(1, (lines +1))): 15 | format = str(t)*i 16 | print(format) 17 | t = t + 1 18 | 19 | if __name__ == "__main__": 20 | main() 21 | -------------------------------------------------------------------------------- /url_shortner.py: -------------------------------------------------------------------------------- 1 | # Importing the required libraries. 2 | import pyshorteners 3 | 4 | # Taking input from the user. 5 | url = input("Enter URL: ") 6 | 7 | # Creating an instance of the pyshorteners library. 8 | shortener = pyshorteners.Shortener() 9 | 10 | # Shortening the URL using TinyURL. 11 | shortened_URL = shortener.tinyurl.short(url) 12 | 13 | # Displaying the shortened URL. 14 | print(f"Shortened URL: {shortened_URL}") 15 | -------------------------------------------------------------------------------- /Patterns/pattern2.py: -------------------------------------------------------------------------------- 1 | #pattern 2 | #$$$$$$$$$$$ 3 | # $$$$$$$$$ 4 | # $$$$$$$ 5 | # $$$$$ 6 | # $$$ 7 | # $ 8 | 9 | 10 | 11 | def main(): 12 | lines = int(input("Enter no.of lines: ")) 13 | pattern(lines) 14 | 15 | def pattern(lines): 16 | flag=lines 17 | for i in range(lines): 18 | print(" "*(i),'$'*(2*flag-1)) 19 | flag-=1 20 | 21 | if __name__ == "__main__": 22 | main() 23 | 24 | -------------------------------------------------------------------------------- /Python Program to Display Fibonacci Sequence Using Recursion.py: -------------------------------------------------------------------------------- 1 | def recur_fibo(n): 2 | if n <= 1: 3 | return n 4 | else: 5 | return(recur_fibo(n-1) + recur_fibo(n-2)) 6 | 7 | nterms = 10 8 | 9 | # check if the number of terms is valid 10 | if nterms <= 0: 11 | print("Please enter a positive integer") 12 | else: 13 | print("Fibonacci sequence:") 14 | for i in range(nterms): 15 | print(recur_fibo(i)) 16 | -------------------------------------------------------------------------------- /Sorting Algorithms/Count sort.py: -------------------------------------------------------------------------------- 1 | def counting_sort(array1, max_val): 2 | m = max_val + 1 3 | count = [0] * m 4 | 5 | for a in array1: 6 | # count occurences 7 | count[a] += 1 8 | i = 0 9 | for a in range(m): 10 | for c in range(count[a]): 11 | array1[i] = a 12 | i += 1 13 | return array1 14 | 15 | 16 | print(counting_sort([1, 2, 7, 3, 2, 1, 4, 2, 3, 2, 1], 7)) 17 | -------------------------------------------------------------------------------- /Web Socket.py: -------------------------------------------------------------------------------- 1 | # Program to print a data & it's Metadata of online uploaded file using "socket". 2 | import socket 3 | skt_c=socket.socket(socket.AF_INET,socket.SOCK_STREAM) 4 | skt_c.connect(('data.pr4e.org',80)) 5 | link='GET http://data.pr4e.org/intro-short.txt HTTP/1.0\r\n\r\n'.encode() 6 | skt_c.send(link) 7 | 8 | while True: 9 | data=skt_c.recv(512) 10 | if len(data)<1: 11 | break 12 | print(data.decode()) 13 | skt_c.close() 14 | -------------------------------------------------------------------------------- /binary_search_trees/inorder_successor.py: -------------------------------------------------------------------------------- 1 | def inorder_successor(root): 2 | # This function returns the inorder successor of a node in a BST 3 | 4 | # The inorder successor of a node is the node with the smallest value greater than the value of the node 5 | current=root 6 | 7 | # The inorder successor is the leftmost node in the right subtree 8 | while current.left is not None: 9 | current=current.left 10 | return current -------------------------------------------------------------------------------- /generate_permutations.py: -------------------------------------------------------------------------------- 1 | def generate(A,k): 2 | if k ==1: 3 | print(A) 4 | return 5 | else: 6 | for i in range(k): 7 | generate(A,k-1) 8 | if(i str: 14 | return self.title 15 | -------------------------------------------------------------------------------- /VoiceAssistant/Project_Basic_struct/speechtotext.py: -------------------------------------------------------------------------------- 1 | import speech_recognition as sr 2 | # initialize the recognizer 3 | r = sr.Recognizer() 4 | def stt(): 5 | with sr.Microphone() as source: 6 | # read the audio data from the default microphone 7 | audio_data = r.record(source, duration=5) 8 | print("Recognizing...") 9 | # convert speech to text 10 | text = r.recognize_google(audio_data) 11 | print(text) -------------------------------------------------------------------------------- /binary_search_trees/inorder_traversal.py: -------------------------------------------------------------------------------- 1 | def inorder(root): 2 | """ This function performs an inorder traversal of a BST""" 3 | 4 | # The inorder traversal of a BST is the nodes in increasing order 5 | if root is None: 6 | return 7 | 8 | # Traverse the left subtree 9 | inorder(root.left) 10 | 11 | # Print the root node 12 | print(root.data) 13 | 14 | # Traverse the right subtree 15 | inorder(root.right) -------------------------------------------------------------------------------- /date-timeserver.py: -------------------------------------------------------------------------------- 1 | import socket 2 | import time 3 | 4 | soc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 5 | soc.bind((socket.gethostname(), 2905)) 6 | soc.listen(5) 7 | while True: 8 | 9 | clientsocket, addr = soc.accept() 10 | 11 | print("estavlishes a connection from %s" % str(addr)) 12 | currentTime = time.ctime(time.time()) + "\r\n" 13 | clientsocket.send(currentTime.encode("ascii")) 14 | clientsocket.close() 15 | -------------------------------------------------------------------------------- /socket-programming/README.md: -------------------------------------------------------------------------------- 1 | # socket-programming-python 2 | Socket programming in python with client-server with duplex alternate chat(client-server-client-server-....) 3 | 4 | # Client view 5 | 6 | ![client](https://user-images.githubusercontent.com/29729380/55186437-8e9f0b00-51bc-11e9-86fa-5641143db32e.png) 7 | 8 | 9 | # Server view 10 | 11 | ![server](https://user-images.githubusercontent.com/29729380/55186445-92cb2880-51bc-11e9-9e67-40a9368cc6c7.png) 12 | -------------------------------------------------------------------------------- /Differentiate_List.py: -------------------------------------------------------------------------------- 1 | # this code gives the numbers of integers, floats, and strings present in the list 2 | 3 | 4 | a = ["Hello", 35, "b", 45.5, "world", 60] 5 | i = f = s = 0 6 | for j in a: 7 | if isinstance(j, int): 8 | i = i + 1 9 | elif isinstance(j, float): 10 | f = f + 1 11 | else: 12 | s = s + 1 13 | print(f"Number of integers are: {i}") 14 | print(f"Number of Floats are: {f}") 15 | print(f"numbers of strings are: {s}") 16 | -------------------------------------------------------------------------------- /Sorting Algorithms/Bubble_Sorting_Prog.py: -------------------------------------------------------------------------------- 1 | def bubblesort(list): 2 | 3 | # Swap the elements to arrange in order 4 | for iter_num in range(len(list) - 1, 0, -1): 5 | for idx in range(iter_num): 6 | if list[idx] > list[idx + 1]: 7 | temp = list[idx] 8 | list[idx] = list[idx + 1] 9 | list[idx + 1] = temp 10 | 11 | 12 | list = [19, 2, 31, 45, 6, 11, 121, 27] 13 | bubblesort(list) 14 | print(list) 15 | -------------------------------------------------------------------------------- /friday.py: -------------------------------------------------------------------------------- 1 | import pyttsx3 2 | import os 3 | 4 | var = 1 5 | 6 | while var > 0: 7 | pyttsx3.speak("How can I help you Sir") 8 | print("How can I help you Sir : ", end="") 9 | x = input() 10 | if (("notepad" in x) or ("Notepad" in x)) and ( 11 | ("open" in x) or ("run" in x) or ("Open" in x) or ("Run" in x) 12 | ): 13 | pyttsx3.speak("Here it is , sir") 14 | os.system("notepad") 15 | print("anything more") 16 | -------------------------------------------------------------------------------- /Palindrome_Checker.py: -------------------------------------------------------------------------------- 1 | """ 2 | 3 | A simple method is , to reverse the string and and compare with original string. 4 | If both are same that's means string is palindrome otherwise else. 5 | """ 6 | phrase = input() 7 | if phrase == phrase[::-1]: # slicing technique 8 | """phrase[::-1] this code is for reverse a string very smartly""" 9 | 10 | print("\n Wow!, The phrase is a Palindrome!") 11 | else: 12 | print("\n Sorry, The given phrase is not a Palindrome.") 13 | -------------------------------------------------------------------------------- /FibonacciNumbersWithGenerators.py: -------------------------------------------------------------------------------- 1 | def fibonacci_generator(n = None): 2 | """ 3 | Generating function up to n fibonacci numbers iteratively 4 | Params: 5 | n: int 6 | Return: 7 | int 8 | """ 9 | f0, f1 = 0, 1 10 | yield f1 11 | while n == None or n > 1: 12 | fn = f0 + f1 13 | yield fn 14 | f0, f1 = f1, fn 15 | n -= 1 16 | 17 | for n_fibo in fibonacci_generator(7): 18 | print(n_fibo) 19 | -------------------------------------------------------------------------------- /nitkarshchourasia/to_sort/JARVIS_python_bot/features_to_add.py: -------------------------------------------------------------------------------- 1 | # imports modules 2 | import sys 3 | import time 4 | from getpass import getuser 5 | 6 | # user puts in their name 7 | name = getuser() 8 | name_check = input("Is your name " + name + "? → ") 9 | if name_check.lower().startswith("y"): 10 | print("Okay.") 11 | time.sleep(1) 12 | 13 | if name_check.lower().startswith("n"): 14 | name = input("Then what is it? → ") 15 | 16 | # Can add this feature to the Jarvis. 17 | -------------------------------------------------------------------------------- /text_to_audio/special_file.txt: -------------------------------------------------------------------------------- 1 | T 2 | e 3 | r 4 | i 5 | 6 | m 7 | a 8 | a 9 | 10 | k 11 | i 12 | 13 | c 14 | h 15 | u 16 | t 17 | , 18 | 19 | b 20 | h 21 | o 22 | s 23 | d 24 | i 25 | k 26 | e 27 | 28 | j 29 | a 30 | k 31 | a 32 | r 33 | 34 | g 35 | a 36 | a 37 | a 38 | n 39 | d 40 | 41 | m 42 | a 43 | a 44 | r 45 | a 46 | a 47 | n 48 | a 49 | a 50 | 51 | c 52 | h 53 | u 54 | t 55 | 56 | m 57 | a 58 | a 59 | a 60 | r 61 | a 62 | a 63 | n 64 | i 65 | 66 | k 67 | e 68 | -------------------------------------------------------------------------------- /Python Program to Remove Punctuations from a String.py: -------------------------------------------------------------------------------- 1 | # define punctuation 2 | punctuations = '''!()-[]{};:'"\,<>./?@#$%^&*_~''' 3 | 4 | my_str = "Hello!!!, he said ---and went." 5 | 6 | # To take input from the user 7 | # my_str = input("Enter a string: ") 8 | 9 | # remove punctuation from the string 10 | no_punct = "" 11 | for char in my_str: 12 | if char not in punctuations: 13 | no_punct = no_punct + char 14 | 15 | # display the unpunctuated string 16 | print(no_punct) 17 | -------------------------------------------------------------------------------- /index.py: -------------------------------------------------------------------------------- 1 | num = 11 2 | #Negative numbers, 0 and 1 are not primes 3 | if num > 1: 4 | 5 | # Iterate from 2 to n // 2 6 | for i in range(2, (num//2)+1): 7 | 8 | # If num is divisible by any number between 9 | #2 and n / 2, it is not prime 10 | if (num % i) == 0: 11 | print(num, "is not a prime number") 12 | break 13 | else: 14 | print(num, "is a prime number") 15 | else: 16 | print(num, "is not a prime number") 17 | -------------------------------------------------------------------------------- /Python Program for Tower of Hanoi.py: -------------------------------------------------------------------------------- 1 | # Recursive Python function to solve the tower of hanoi 2 | def TowerOfHanoi(n , source, destination, auxiliary): 3 | if n==1: 4 | print("Move disk 1 from source ",source," to destination ",destination) 5 | return 6 | TowerOfHanoi(n-1, source, auxiliary, destination) 7 | print("Move disk ",n," from source ",source," to destination ",destination) 8 | TowerOfHanoi(n-1, auxiliary, destination, source) 9 | n = 4 10 | TowerOfHanoi(n,'A','B','C') 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.pyc 3 | string=sorted(input()) 4 | lower="" 5 | even="" 6 | odd="" 7 | upper="" 8 | for i in string: 9 | if i.islower(): 10 | lower+=i 11 | elif i.isupper(): 12 | upper+=i 13 | elif int(i)%2==0: 14 | even+=i 15 | else: 16 | odd+=i 17 | print(lower+upper+odd+even) 18 | 19 | # operating system-related files 20 | 21 | # file properties cache/storage on macOS 22 | *.DS_Store 23 | 24 | # thumbnail cache on Windows 25 | Thumbs.db 26 | -------------------------------------------------------------------------------- /Crack_password.py: -------------------------------------------------------------------------------- 1 | from random import * 2 | user_pass = input("Enter your password: ") 3 | password = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j','k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't','u','v','w', 'x', 'y', 'z',] 4 | guess = "" 5 | while (guess != user_pass): 6 | guess = "" 7 | for letter in range(len(user_pass)): 8 | guess_letter = password[randint(0, 25)] 9 | guess = str(guess_letter) + str(guess) 10 | print(guess) 11 | print("Your password is",guess) 12 | -------------------------------------------------------------------------------- /diamond.py: -------------------------------------------------------------------------------- 1 | def draw_diamond(n): 2 | if n % 2 != 0: 3 | k = 1 4 | while k <= n: 5 | print(" " * int((n - k) / 2) + "*" * k + " " * int((n - k) / 2)) 6 | k += 2 7 | 8 | j = 1 9 | while (n - 2 * j) >= 1: 10 | print(" " * j + "*" * (n - 2 * j) + " " * (j)) 11 | j += 1 12 | else: 13 | print("Not an odd number. Can't draw a diamond :(") 14 | 15 | 16 | n = int(input("Enter an odd number: ")) 17 | draw_diamond(n) 18 | -------------------------------------------------------------------------------- /email id dictionary/README.md: -------------------------------------------------------------------------------- 1 | Write a program to read through the mbox-short.txt and figure out who has sent the greatest number of mail messages. The program looks for 'From ' lines and takes the second word of those lines as the person who sent the mail. The program creates a Python dictionary that maps the sender's mail address to a count of the number of times they appear in the file. After the dictionary is produced, the program reads through the dictionary using a maximum loop to find the most prolific committer. -------------------------------------------------------------------------------- /finding LCM.py: -------------------------------------------------------------------------------- 1 | 2 | # Python Program to find the L.C.M. of two input number 3 | 4 | def compute_lcm(x, y): 5 | 6 | # choose the greater number 7 | if x > y: 8 | greater = x 9 | else: 10 | greater = y 11 | 12 | while(True): 13 | if((greater % x == 0) and (greater % y == 0)): 14 | lcm = greater 15 | break 16 | greater += 1 17 | 18 | return lcm 19 | 20 | num1 = 54 21 | num2 = 24 22 | 23 | print("The L.C.M. is", compute_lcm(num1, num2)) 24 | -------------------------------------------------------------------------------- /Downloaded Files Organizer/browser_status.py: -------------------------------------------------------------------------------- 1 | import psutil 2 | from obs import watcher 3 | 4 | browsers = ["chrome.exe", "firefox.exe", "edge.exe", "iexplore.exe"] 5 | 6 | # ADD DOWNLOADS PATH HERE::: r is for raw string enter the path 7 | # Example: path_to_watch=r"C:\Users\Xyz\Downloads" 8 | # find downloads path . 9 | 10 | 11 | path_to_watch = r" " 12 | 13 | 14 | for browser in browsers: 15 | while browser in (process.name() for process in psutil.process_iter()): 16 | watcher(path_to_watch) 17 | -------------------------------------------------------------------------------- /Python Program to Find LCM.py: -------------------------------------------------------------------------------- 1 | # Python Program to find the L.C.M. of two input number 2 | 3 | def compute_lcm(x, y): 4 | 5 | # choose the greater number 6 | if x > y: 7 | greater = x 8 | else: 9 | greater = y 10 | 11 | while(True): 12 | if((greater % x == 0) and (greater % y == 0)): 13 | lcm = greater 14 | break 15 | greater += 1 16 | 17 | return lcm 18 | 19 | num1 = 54 20 | num2 = 24 21 | 22 | print("The L.C.M. is", compute_lcm(num1, num2)) 23 | -------------------------------------------------------------------------------- /count the numbers of two vovels.py: -------------------------------------------------------------------------------- 1 | # Program to count the number of each vowels 2 | 3 | # string of vowels 4 | vowels = 'aeiou' 5 | 6 | ip_str = 'Hello, have you tried our tutorial section yet?' 7 | 8 | # make it suitable for caseless comparisions 9 | ip_str = ip_str.casefold() 10 | 11 | # make a dictionary with each vowel a key and value 0 12 | count = {}.fromkeys(vowels,0) 13 | 14 | # count the vowels 15 | for char in ip_str: 16 | if char in count: 17 | count[char] += 1 18 | 19 | print(count) 20 | -------------------------------------------------------------------------------- /Sorting Algorithms/SortingAStringAlphabetically.py: -------------------------------------------------------------------------------- 1 | # Program to sort alphabetically the words form a string provided by the user 2 | 3 | my_str = "Hello this Is an Example With cased letters" 4 | 5 | # To take input from the user 6 | # my_str = input("Enter a string: ") 7 | 8 | # breakdown the string into a list of words 9 | words = my_str.split() 10 | 11 | # sort the list 12 | words.sort() 13 | 14 | # display the sorted words 15 | 16 | print("The sorted words are:") 17 | for word in words: 18 | print(word) 19 | -------------------------------------------------------------------------------- /armstrongnumber.py: -------------------------------------------------------------------------------- 1 | # Python program to check if the number is an Armstrong number or not 2 | 3 | # take input from the user 4 | num = int(input("Enter a number: ")) 5 | 6 | # initialize sum 7 | sum = 0 8 | 9 | # find the sum of the cube of each digit 10 | temp = num 11 | while temp > 0: 12 | digit = temp % 10 13 | sum += digit ** 3 14 | temp //= 10 15 | 16 | # display the result 17 | if num == sum: 18 | print(num, "is an Armstrong number") 19 | else: 20 | print(num, "is not an Armstrong number") 21 | -------------------------------------------------------------------------------- /birthdays.py: -------------------------------------------------------------------------------- 1 | birthdays = {'Alice': 'Apr 1', 'Bob': 'Dec 12', 'Carol': 'Mar 4'} 2 | while True: 3 | 4 | print('Enter a name: (blank to quit)') 5 | name = input() 6 | if name == '': 7 | break 8 | if name in birthdays: 9 | print(birthdays[name] + ' is the birthday of ' + name) 10 | else: 11 | print('I do not have birthday information for ' + name) 12 | print('What is their birthday?') 13 | bday = input() 14 | birthdays[name] = bday 15 | print('Birthday database updated.') 16 | -------------------------------------------------------------------------------- /triangles.py: -------------------------------------------------------------------------------- 1 | max_size = 10 2 | 3 | print( 4 | "(a)" 5 | + " " * (max_size) 6 | + "(b)" 7 | + " " * (max_size) 8 | + "(c)" 9 | + " " * (max_size) 10 | + "(d)" 11 | + " " * (max_size) 12 | ) 13 | 14 | for i in range(1, max_size + 1): 15 | 16 | print("*" * i, end=" " * (max_size - i + 3)) 17 | 18 | print("*" * (max_size - i + 1), end=" " * (i - 1 + 3)) 19 | 20 | print(" " * (i - 1) + "*" * (max_size - i + 1), end=" " * 3) 21 | 22 | print(" " * (max_size - i) + "*" * i) 23 | -------------------------------------------------------------------------------- /Calculate resistance.py: -------------------------------------------------------------------------------- 1 | def res(R1, R2): 2 | sum = R1 + R2 3 | if option =="series": 4 | return sum 5 | elif option =="parallel" : 6 | return (R1 * R2)/sum 7 | return 0 8 | Resistance1 = int(input("Enter R1 : ")) 9 | Resistance2 = int(input("Enter R2 : ")) 10 | option = input("Enter series or parallel :") 11 | print("\n") 12 | R = res(Resistance1,Resistance2 ) 13 | if R==0: 14 | print('Wrong Input!!' ) 15 | else: 16 | print("The total resistance is", R) 17 | -------------------------------------------------------------------------------- /Checker_game_by_dz/modules/statics.py: -------------------------------------------------------------------------------- 1 | """ 2 | Author : Dhruv B Kakadiya 3 | 4 | """ 5 | 6 | import pygame as pg 7 | 8 | # size of board 9 | width, height = 800, 800 10 | rows, cols = 8, 8 11 | sq_size = width // cols 12 | 13 | # colours for board 14 | yellow = (255, 255, 0) 15 | white = (255, 255, 255) 16 | green = (0, 255, 0) 17 | gray = (128, 128, 128) 18 | red = (255, 0, 0) 19 | 20 | # colour for for next move 21 | black = (0, 0, 0) 22 | 23 | crown = pg.transform.scale(pg.image.load("assets/crown.png"), (45, 25)) 24 | -------------------------------------------------------------------------------- /insta_image_saving/instructions.txt: -------------------------------------------------------------------------------- 1 | INSTRUCTIONS FOR SUCCESSFUL OPERATION : 2 | 3 | --> hardcode variable "instaccountlink" with desired instagram URL 4 | --> hardcode variable "instaaccountname" with desired name 5 | --> hardcode variable "file" with desired output name 6 | --> set condition for scrolling, i.e. variable "i" which is by default set to 300 7 | --> you may need to redefine HTML tags used, as these are regularly changed as per INSTAGRAM security concerns, the HTML tags used here is latest as per best of my knowledge. -------------------------------------------------------------------------------- /AreaOfTriangle.py: -------------------------------------------------------------------------------- 1 | # Python Program to find the area of triangle when all three side-lengths are known! 2 | 3 | a = 5 4 | b = 6 5 | c = 7 6 | 7 | # Uncomment below to take inputs from the user 8 | # a = float(input('Enter first side: ')) 9 | # b = float(input('Enter second side: ')) 10 | # c = float(input('Enter third side: ')) 11 | 12 | # calculate the semi-perimeter 13 | s = (a + b + c) / 2 14 | 15 | # calculate the area 16 | area = (s * (s - a) * (s - b) * (s - c)) ** 0.5 17 | print("The area of the triangle is: " + area) 18 | -------------------------------------------------------------------------------- /Binary_to_Decimal.py: -------------------------------------------------------------------------------- 1 | # Program to convert binary to decimal 2 | 3 | 4 | def binaryToDecimal(binary): 5 | """ 6 | >>> binaryToDecimal(111110000) 7 | 496 8 | >>> binaryToDecimal(10100) 9 | 20 10 | >>> binaryToDecimal(101011) 11 | 43 12 | """ 13 | decimal, i, n = 0, 0, 0 14 | while binary != 0: 15 | dec = binary % 10 16 | decimal = decimal + dec * pow(2, i) 17 | binary = binary // 10 18 | i += 1 19 | print(decimal) 20 | 21 | 22 | binaryToDecimal(100) 23 | -------------------------------------------------------------------------------- /Python Program to Count the Number of Each Vowel.py: -------------------------------------------------------------------------------- 1 | # Program to count the number of each vowels 2 | 3 | # string of vowels 4 | vowels = 'aeiou' 5 | 6 | ip_str = 'Hello, have you tried our tutorial section yet?' 7 | 8 | # make it suitable for caseless comparisions 9 | ip_str = ip_str.casefold() 10 | 11 | # make a dictionary with each vowel a key and value 0 12 | count = {}.fromkeys(vowels,0) 13 | 14 | # count the vowels 15 | for char in ip_str: 16 | if char in count: 17 | count[char] += 1 18 | 19 | print(count) 20 | -------------------------------------------------------------------------------- /googlemaps.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import json 3 | import geocoder 4 | 5 | g = geocoder.ip("me") 6 | 7 | lat = g.latlng[0] 8 | 9 | longi = g.latlng[1] 10 | query = input("Enter the query") 11 | 12 | key = "your_api_key" 13 | url = ( 14 | "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=" 15 | + str(lat) 16 | + "," 17 | + str(longi) 18 | + "radius=1000" 19 | ) 20 | 21 | r = requests.get(url + "query=" + query + "&key=" + key) 22 | 23 | x = r.json() 24 | y = x["results"] 25 | print(y) 26 | -------------------------------------------------------------------------------- /nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo_site/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for todo_site project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "todo_site.settings") 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo_site/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for todo_site project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "todo_site.settings") 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /testlines.py: -------------------------------------------------------------------------------- 1 | # Script Name : testlines.py 2 | # Author : Craig Richards 3 | # Created : 08th December 2011 4 | # Last Modified : 5 | # Version : 1.0 6 | 7 | # Modifications : beven nyamande 8 | 9 | # Description : This is a very simple script that opens up a file and writes whatever is set " 10 | 11 | 12 | def write_to_file(filename, txt): 13 | with open(filename, "w") as file_object: 14 | s = file_object.write(txt) 15 | 16 | 17 | if __name__ == "__main__": 18 | write_to_file("test.txt", "I am beven") 19 | -------------------------------------------------------------------------------- /1 File handle/File handle binary/Deleting record in a binary file.py: -------------------------------------------------------------------------------- 1 | import pickle 2 | 3 | 4 | def bdelete(): 5 | # Opening a file & loading it 6 | with open("studrec.dat","rb") as F: 7 | stud = pickle.load(F) 8 | print(stud) 9 | 10 | # Deleting the Roll no. entered by user 11 | rno = int(input("Enter the Roll no. to be deleted: ")) 12 | with open("studrec.dat","wb") as F: 13 | rec = [i for i in stud if i[0] != rno] 14 | pickle.dump(rec, F) 15 | 16 | 17 | bdelete() 18 | -------------------------------------------------------------------------------- /Turtle_Star.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | 3 | board = turtle.Turtle() 4 | 5 | # first triangle for star 6 | board.forward(100) # draw base 7 | 8 | board.left(120) 9 | board.forward(100) 10 | 11 | board.left(120) 12 | board.forward(100) 13 | 14 | board.penup() 15 | board.right(150) 16 | board.forward(50) 17 | 18 | # second triangle for star 19 | board.pendown() 20 | board.right(90) 21 | board.forward(100) 22 | 23 | board.right(120) 24 | board.forward(100) 25 | 26 | board.right(120) 27 | board.forward(100) 28 | 29 | turtle.done() 30 | -------------------------------------------------------------------------------- /leap year.py: -------------------------------------------------------------------------------- 1 | # Python program to check if year is a leap year or not 2 | 3 | year = 2000 4 | 5 | # To get year (integer input) from the user 6 | # year = int(input("Enter a year: ")) 7 | 8 | if (year % 4) == 0: 9 | if (year % 100) == 0: 10 | if (year % 400) == 0: 11 | print("{0} is a leap year".format(year)) 12 | else: 13 | print("{0} is not a leap year".format(year)) 14 | else: 15 | print("{0} is a leap year".format(year)) 16 | else: 17 | print("{0} is not a leap year".format(year)) 18 | -------------------------------------------------------------------------------- /rotate_string.py: -------------------------------------------------------------------------------- 1 | def left_rotate(s, val): 2 | s1 = s[0:val] 3 | s2 = s[val:] 4 | return s2 + s1 5 | 6 | 7 | def right_rotate(s, val): 8 | s1 = s[0 : len(s) - val] 9 | s2 = s[len(s) - val :] 10 | return s2 + s1 11 | 12 | 13 | def circular_rotate(s): 14 | s = list(s) 15 | idx = 0 16 | mid = len(s) // 2 17 | for i in reversed(range(mid, len(s))): 18 | s[idx], s[i] = s[i], s[idx] 19 | idx += 1 20 | return s 21 | 22 | 23 | s = "aditya" 24 | print("".join(circular_rotate(s))) 25 | -------------------------------------------------------------------------------- /AREA OF TRIANGLE.py: -------------------------------------------------------------------------------- 1 | # Python Program to find the area of triangle 2 | # calculates area of traingle in efficient way!! 3 | a = 5 4 | b = 6 5 | c = 7 6 | 7 | # Uncomment below to take inputs from the user 8 | # a = float(input('Enter first side: ')) 9 | # b = float(input('Enter second side: ')) 10 | # c = float(input('Enter third side: ')) 11 | 12 | # calculate the semi-perimeter 13 | s = (a + b + c) / 2 14 | 15 | # calculate the area 16 | area = (s * (s - a) * (s - b) * (s - c)) ** 0.5 17 | print("The area of the triangle is %0.2f" % area) 18 | -------------------------------------------------------------------------------- /Sorting Algorithms/sorting.py: -------------------------------------------------------------------------------- 1 | arr = [7, 2, 8, 5, 1, 4, 6, 3] 2 | temp = 0 3 | 4 | print("Elements of original array: ") 5 | for i in range(0, len(arr)): 6 | print(arr[i], end=" ") 7 | 8 | for i in range(0, len(arr)): 9 | for j in range(i + 1, len(arr)): 10 | if arr[i] > arr[j]: 11 | temp = arr[i] 12 | arr[i] = arr[j] 13 | arr[j] = temp 14 | 15 | print() 16 | 17 | 18 | print("Elements of array sorted in ascending order: ") 19 | for i in range(0, len(arr)): 20 | print(arr[i], end=" ") 21 | -------------------------------------------------------------------------------- /fibonici series.py: -------------------------------------------------------------------------------- 1 | nterms = int(input("How many terms? ")) 2 | 3 | # first two terms 4 | n1, n2 = 0, 1 5 | count = 0 6 | 7 | # check if the number of terms is valid 8 | if nterms <= 0: 9 | print("Please enter a positive integer") 10 | elif nterms == 1: 11 | print("Fibonacci sequence upto",nterms,":") 12 | print(n1) 13 | else: 14 | print("Fibonacci sequence:") 15 | while count < nterms: 16 | print(n1) 17 | nth = n1 + n2 18 | # update values 19 | n1 = n2 20 | n2 = nth 21 | count += 1 22 | -------------------------------------------------------------------------------- /to check leap year: -------------------------------------------------------------------------------- 1 | # Python program to check if year is a leap year or not 2 | 3 | year = 2000 4 | 5 | # To get year (integer input) from the user 6 | # year = int(input("Enter a year: ")) 7 | 8 | if (year % 4) == 0: 9 | if (year % 100) == 0: 10 | if (year % 400) == 0: 11 | print("{0} is a leap year".format(year)) 12 | else: 13 | print("{0} is not a leap year".format(year)) 14 | else: 15 | print("{0} is a leap year".format(year)) 16 | else: 17 | print("{0} is not a leap year".format(year)) 18 | -------------------------------------------------------------------------------- /Binary Coefficients.py: -------------------------------------------------------------------------------- 1 | def pascal_triangle(lineNumber): 2 | list1 = list() 3 | list1.append([1]) 4 | i = 1 5 | while i <= lineNumber: 6 | j = 1 7 | l = [] 8 | l.append(1) 9 | while j < i: 10 | l.append(list1[i - 1][j] + list1[i - 1][j - 1]) 11 | j = j + 1 12 | l.append(1) 13 | list1.append(l) 14 | i = i + 1 15 | return list1 16 | 17 | 18 | def binomial_coef(n, k): 19 | pascalTriangle = pascal_triangle(n) 20 | return pascalTriangle[n][k - 1] 21 | -------------------------------------------------------------------------------- /Colors/print_colors.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | 4 | class colors: 5 | CYAN = "\033[36m" 6 | GREEN = "\033[32m" 7 | YELLOW = "\033[33m" 8 | BLUE = "\033[34m" 9 | RED = "\033[31m" 10 | ENDC = "\033[0m" 11 | 12 | 13 | def printc(color, message): 14 | print(color + message + colors.ENDC) 15 | 16 | 17 | # color which we print or import 18 | printc(colors.CYAN, sys.argv[1]) 19 | printc(colors.GREEN, sys.argv[1]) 20 | printc(colors.YELLOW, sys.argv[1]) 21 | printc(colors.BLUE, sys.argv[1]) 22 | printc(colors.RED, sys.argv[1]) 23 | -------------------------------------------------------------------------------- /Search_Engine/README.md: -------------------------------------------------------------------------------- 1 | Python Program to search through various documents and return the documents containing the search term. Algorithm involves using a reverse index to store each word in each document where a document is defined by an index. To get the document that contains a search term, we simply find an intersect of all the words in the search term, and using the resulting indexes, retrieve the document(s) that contain these words 2 | 3 | To use directly, run 4 | 5 | ```python3 backend.py``` 6 | 7 | To use a gui, run 8 | 9 | ```python3 frontend.py``` -------------------------------------------------------------------------------- /gambler.py: -------------------------------------------------------------------------------- 1 | import random 2 | from sys import argv 3 | 4 | stake = int(argv[1]) 5 | goals = int(argv[2]) 6 | trials = int(argv[3]) 7 | 8 | wins = 0 9 | bets = 0 10 | 11 | for i in range(trials): 12 | cash = stake 13 | while cash > 0 and cash < goals: 14 | bets += 1 15 | if random.randrange(0, 2) == 0: 16 | cash += 1 17 | else: 18 | cash -= 1 19 | if cash == goals: 20 | wins += 1 21 | print("Your won: " + str(100 * wins // trials) + "$") 22 | print("Your bets: " + str(bets // trials)) 23 | -------------------------------------------------------------------------------- /nDigitNumberCombinations.py: -------------------------------------------------------------------------------- 1 | # ALL the combinations of n digit combo 2 | def nDigitCombinations(n): 3 | try: 4 | npow = 10 ** n 5 | numbers = [] 6 | for code in range(npow): 7 | code = str(code).zfill(n) 8 | numbers.append(code) 9 | except Exception: 10 | # handle all other exceptions 11 | pass 12 | return numbers 13 | 14 | 15 | # An alternate solution: 16 | # from itertools import product 17 | # from string import digits 18 | # list("".join(x) for x in product(digits, repeat=n)) 19 | -------------------------------------------------------------------------------- /polygon.py: -------------------------------------------------------------------------------- 1 | import pygame 2 | import sys 3 | from pygame.locals import * 4 | 5 | pygame.init() 6 | window = pygame.display.set_mode((400, 300), 0, 32) 7 | pygame.display.set_caption("Shape") 8 | 9 | WHITE = (255, 255, 255) 10 | GREEN = (0, 255, 0) 11 | 12 | window.fill(WHITE) 13 | pygame.draw.polygon(window, GREEN, ((146, 0), (236, 277), (56, 277))) 14 | 15 | # Game logic 16 | while True: 17 | for event in pygame.event.get(): 18 | if event.type == QUIT: 19 | pygame.quit() 20 | sys.exit() 21 | pygame.display.update() 22 | -------------------------------------------------------------------------------- /ultimate-phone-book/readme.md: -------------------------------------------------------------------------------- 1 | #### THIS PROGRAM USES [GPL V3 LICENSE](../../LICENSE) 2 | 3 | ## contacts 4 | it's an simple phonebook allowing you to add name, contact number and email. 5 | it's just for fun there is no use in real life. 6 | 7 | #### Requirenments 8 | a python interpretor in Windows, terminal will work in Mac & Linux. 9 | 10 | #### How to run? 11 | as a **python3** program 12 | 13 | #### Contributers 14 | created by 15 | [**@JymPatel**](https://github.com/JymPatel) 16 | edited by 17 | (editors can put their names here) 18 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "pip" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "daily" 12 | -------------------------------------------------------------------------------- /add_two_number.py: -------------------------------------------------------------------------------- 1 | user_input = (input("type type 'start' to run program:")).lower() 2 | 3 | if user_input == 'start': 4 | is_game_running = True 5 | else: 6 | is_game_running = False 7 | 8 | 9 | while (is_game_running): 10 | num1 = int(input("enter number 1:")) 11 | num2 = int(input("enter number 2:")) 12 | num3 = num1+num2 13 | print(f"sum of {num1} and {num2} is {num3}") 14 | user_input = (input("if you want to discontinue type 'stop':")).lower() 15 | if user_input == "stop": 16 | is_game_running = False 17 | 18 | -------------------------------------------------------------------------------- /quote.py: -------------------------------------------------------------------------------- 1 | # Sends inspirational quotes to the user using Zen Quotes API 2 | 3 | # Format 4 | """ 5 | example quote -Quote Author Name 6 | """ 7 | 8 | import requests 9 | from json import loads 10 | 11 | 12 | def return_quote(): 13 | response = requests.get("https://zenquotes.io/api/random") 14 | json_data = loads(response.text) 15 | quote = ( 16 | json_data[0]["q"] + " -" + json_data[0]["a"] 17 | ) # aligning the quote and it's author name in one string 18 | return quote 19 | 20 | 21 | quote = return_quote() 22 | print(quote) 23 | -------------------------------------------------------------------------------- /video-operations/slow-motion.py: -------------------------------------------------------------------------------- 1 | # author : Avee Chakraborty 2 | # Department of software engineering, Diu 3 | # Bangladesh 4 | 5 | import cv2 6 | 7 | capture = cv2.VideoCapture(0) 8 | fourcc = cv2.VideoWriter_fourcc(*"XVID") 9 | output = cv2.VideoWriter("slowmotion.mp4", fourcc, 5, (640, 480)) 10 | 11 | while True: 12 | ret, frame = capture.read() 13 | output.write(frame) 14 | cv2.imshow("frame", frame) 15 | if cv2.waitKey(1) & 0xFF == ord("x"): 16 | break 17 | 18 | capture.release() 19 | output.release() 20 | cv2.destroyAllWindows() 21 | -------------------------------------------------------------------------------- /cricket_live_score.py: -------------------------------------------------------------------------------- 1 | from urllib.request import urlopen as uReq 2 | 3 | from bs4 import BeautifulSoup as soup 4 | 5 | my_url = "http://www.cricbuzz.com/" 6 | Client = uReq(my_url) 7 | 8 | html_page = Client.read() 9 | Client.close() 10 | 11 | soup_page = soup(html_page, "html.parser") 12 | 13 | score_box = soup_page.findAll("div", {"class": "cb-col cb-col-25 cb-mtch-blk"}) 14 | score_box_len = len(score_box) 15 | print(score_box_len) 16 | for i in range(score_box_len): 17 | print(score_box[i].a["title"]) 18 | print(score_box[i].a.text) 19 | print() 20 | -------------------------------------------------------------------------------- /video-operations/timelapse.py: -------------------------------------------------------------------------------- 1 | # author : Avee Chakraborty 2 | # Department of software engineering, Diu 3 | # Bangladesh 4 | 5 | 6 | import cv2 7 | 8 | capture = cv2.VideoCapture(0) 9 | fourcc = cv2.VideoWriter_fourcc(*"XVID") 10 | output = cv2.VideoWriter("timelapse.mp4", fourcc, 30, (640, 480)) 11 | 12 | while True: 13 | ret, frame = capture.read() 14 | output.write(frame) 15 | cv2.imshow("frame", frame) 16 | if cv2.waitKey(1) & 0xFF == ord("x"): 17 | break 18 | 19 | capture.release() 20 | output.release() 21 | cv2.destroyAllWindows() 22 | -------------------------------------------------------------------------------- /1 File handle/File handle text/input,output and error streams.py: -------------------------------------------------------------------------------- 1 | # practicing with streams 2 | import sys 3 | 4 | sys.stdout.write("Enter the name of the file") 5 | file = sys.stdin.readline() 6 | 7 | with open(file.strip(), ) as F: 8 | 9 | while True: 10 | ch = F.readlines() 11 | for (i) in ch: # ch is the whole file,for i in ch gives lines, for j in i gives letters,for j in i.split gives words 12 | print(i, end="") 13 | else: 14 | sys.stderr.write("End of file reached") 15 | break 16 | 17 | -------------------------------------------------------------------------------- /Sorting Algorithms/Sort the values of first list using second list.py: -------------------------------------------------------------------------------- 1 | # one list using 2 | # the other list 3 | 4 | 5 | def sort_list(list1, list2): 6 | 7 | zipped_pairs = zip(list2, list1) 8 | 9 | z = [x for _, x in sorted(zipped_pairs)] 10 | 11 | return z 12 | 13 | 14 | # driver code 15 | x = ["a", "b", "c", "d", "e", "f", "g", "h", "i"] 16 | y = [0, 1, 1, 0, 1, 2, 2, 0, 1] 17 | 18 | print(sort_list(x, y)) 19 | 20 | x = ["g", "e", "e", "k", "s", "f", "o", "r", "g", "e", "e", "k", "s"] 21 | y = [0, 1, 1, 0, 1, 2, 2, 0, 1] 22 | 23 | print(sort_list(x, y)) 24 | -------------------------------------------------------------------------------- /love_turtle.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | 3 | 4 | def heart_red(): 5 | t = turtle.Turtle() 6 | turtle.title("I Love You") 7 | screen = turtle.Screen() 8 | screen.bgcolor("white") 9 | t.color("red") 10 | t.begin_fill() 11 | t.fillcolor("red") 12 | 13 | t.left(140) 14 | t.forward(180) 15 | t.circle(-90, 200) 16 | 17 | t.setheading(60) # t.left 18 | t.circle(-90, 200) 19 | t.forward(180) 20 | 21 | t.end_fill() 22 | t.hideturtle() 23 | 24 | turtle.done() 25 | 26 | 27 | if __name__ == "__main__": 28 | heart_red() 29 | -------------------------------------------------------------------------------- /Industrial_developed_hangman/Data/text_images.txt: -------------------------------------------------------------------------------- 1 | ╔══╗─╔╗╔╗╔══╗╔═══╗─╔══╗╔╗╔╗╔╗╔╗╔══╗ 2 | ║╔╗║─║║║║║╔═╝║╔══╝─║╔╗║║║║║║║║║║╔╗║ 3 | ║╚╝╚╗║║║║║║──║╚══╗─║║║║║║║║║║║║║╚╝║ 4 | ║╔═╗║║║╔║║║──║╔══╝─║║║║║║╔║║║║║║╔╗║ 5 | ║╚═╝║║╚╝║║╚═╗║╚══╗╔╝║║║║╚╝║║╚╝║║║║║ 6 | ╚═══╝╚══╝╚══╝╚═══╝╚═╝╚╝╚══╝╚══╗╚╝╚╝ 7 | ⡖⠒⢒⣶⠖⠒⠒⠒⡖⠒⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ 8 | ⡇⣠⠟⠁⠀⠀⠀⡖⠓⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ 9 | ⡿⠉⠀⠀⠀⠀⠀⢹⣞⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ 10 | ⡇⠀⠀⠀⠀⠀⣠⠻⡟⢧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ 11 | ⠀ ⡇⠀⠀⠀⠀⠐⠃⢨⡧⠀⠳⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ 12 | ⠀⠀ ⡇⠀⠀⠀⠀⠀⠀⠠⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ 13 | ⠀⠀ ⡇⠀⠀⠀⠀⠀⠀⢨⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ 14 | ⠀⠀ ⡇⠀⠀⠀⠀⠀⠀⠆⠘⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ 15 | ⠀⠀ ⡇⠀⠀⠀⠀⠀⠈⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ 16 | ⠀⠀ ⠧⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤ 17 | -------------------------------------------------------------------------------- /binary_search_trees/mirror_a_bst.py: -------------------------------------------------------------------------------- 1 | from tree_node import Node 2 | def create_mirror_bst(root): 3 | """ Function to create a mirror of a binary search tree""" 4 | 5 | # If the tree is empty, return None 6 | if root is None: 7 | return None 8 | 9 | # Create a new node with the root value 10 | 11 | # Recursively create the mirror of the left and right subtrees 12 | left_mirror = create_mirror_bst(root.left) 13 | right_mirror = create_mirror_bst(root.right) 14 | root.left = right_mirror 15 | root.right = left_mirror 16 | return root -------------------------------------------------------------------------------- /text-to-audio/main.py: -------------------------------------------------------------------------------- 1 | from gtts import gTTS 2 | import os 3 | 4 | # Enter the text in string format which you want to convert to audio 5 | mytext = "Hello World!, this audio is created using GTTS module." 6 | 7 | # Specify the language in which you want your audio 8 | language = "en" 9 | 10 | # Create an instance of gTTS class 11 | myobj = gTTS(text=mytext, lang=language, slow=False) 12 | 13 | # Method to create your audio file in mp3 format 14 | myobj.save("hello_world.mp3") 15 | print("Audio Saved") 16 | 17 | # This will play your audio file 18 | os.system("mpg321 welcome.mp3") 19 | -------------------------------------------------------------------------------- /live_sketch.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | 3 | 4 | def sketch(image): 5 | img_gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) 6 | img_gray_blur = cv2.GaussianBlur(img_gray, (5, 5), 0) 7 | canny_edges = cv2.Canny(img_gray_blur, 10, 70) 8 | ret, mask = cv2.threshold(canny_edges, 70, 255, cv2.THRESH_BINARY_INV) 9 | return mask 10 | 11 | 12 | cap = cv2.VideoCapture(0) 13 | 14 | while True: 15 | ret, frame = cap.read() 16 | cv2.imshow("Our Live Sketcher", sketch(frame)) 17 | if cv2.waitKey(1) == 13: 18 | break 19 | 20 | cap.release() 21 | cv2.destroyAllWindows() 22 | -------------------------------------------------------------------------------- /Turn your PDFs into audio books/audiobook_gen.py: -------------------------------------------------------------------------------- 1 | import PyPDF2 2 | import pyttsx3 3 | 4 | book = open(input("Enter the book name: "), "rb") 5 | pg_no = int( 6 | input( 7 | "Enter the page number from which you want the system to start reading text: " 8 | ) 9 | ) 10 | 11 | pdf_Reader = PyPDF2.PdfFileReader(book) 12 | pages = pdf_Reader.numPages 13 | 14 | speaker = pyttsx3.init() 15 | 16 | for num in range((pg_no - 1), pages): 17 | page = pdf_Reader.getPage(num) 18 | text = page.extractText() 19 | speaker.say(text) 20 | speaker.runAndWait() 21 | -------------------------------------------------------------------------------- /fetch_news.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | _NEWS_API = "https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey=" 4 | 5 | 6 | def fetch_bbc_news(bbc_news_api_key: str) -> None: 7 | # fetching a list of articles in json format 8 | bbc_news_page = requests.get(_NEWS_API + bbc_news_api_key).json() 9 | # each article in the list is a dict 10 | for news, article in enumerate(bbc_news_page["articles"], 1): 11 | print(f"{news}.) {article['title']}") 12 | 13 | 14 | if __name__ == "__main__": 15 | fetch_bbc_news(bbc_news_api_key="") 16 | -------------------------------------------------------------------------------- /new_pattern.py: -------------------------------------------------------------------------------- 1 | #pattern 2 | #@@@@@@@@ $ 3 | #@@@@@@@ $$ 4 | #@@@@@@ $$$ 5 | #@@@@@ $$$$ 6 | #@@@@ $$$$$ 7 | #@@@ $$$$$$ 8 | #@@ $$$$$$$ 9 | #@ $$$$$$$$ 10 | 11 | def main(): 12 | lines = int(input("Enter no.of lines: ")) 13 | pattern(lines) 14 | 15 | def pattern(lines): 16 | t = 1 17 | for i in range(lines,0,-1): 18 | nxt_pattern = "$"*t 19 | pattern = "@"*(i) 20 | final_pattern = pattern + " " + nxt_pattern 21 | print(final_pattern) 22 | t = t +1 23 | 24 | if __name__ == "__main__": 25 | main() 26 | -------------------------------------------------------------------------------- /Dictionary opperations (input,update a dict).py: -------------------------------------------------------------------------------- 1 | # Update the value of dictionary written by the user... 2 | 3 | print("Dictinary opperations") 4 | 5 | 6 | def Dictionary(Dict, key, value): 7 | print("Original dictionary", Dict) 8 | Dict[key] = value 9 | print("Updated dictionary", Dict) 10 | 11 | 12 | d = eval(input("Enter the dictionary")) 13 | print("Dictionary", d, "\n") 14 | 15 | k = input("Enter the key to be updated") 16 | if k in d.keys(): 17 | v = input("Enter the updated value") 18 | Dictionary(d, k, v) 19 | 20 | else: 21 | print("Key not found") 22 | -------------------------------------------------------------------------------- /Wikipdedia/main.py: -------------------------------------------------------------------------------- 1 | # This is a sample Python script. 2 | 3 | # Press Shift+F10 to execute it or replace it with your code. 4 | # Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. 5 | 6 | 7 | def print_hi(name): 8 | # Use a breakpoint in the code line below to debug your script. 9 | print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint. 10 | 11 | 12 | # Press the green button in the gutter to run the script. 13 | if __name__ == '__main__': 14 | print_hi('PyCharm') 15 | 16 | # See PyCharm help at https://www.jetbrains.com/help/pycharm/ 17 | -------------------------------------------------------------------------------- /four_digit_num_combination.py: -------------------------------------------------------------------------------- 1 | """ small script to learn how to print out all 4-digit num""" 2 | 3 | 4 | # ALL the combinations of 4 digit combo 5 | def four_digit_combinations(): 6 | """print out all 4-digit numbers in old way""" 7 | numbers = [] 8 | for code in range(10000): 9 | code = str(code).zfill(4) 10 | print(code) 11 | numbers.append(code) 12 | 13 | 14 | # Same as above but more pythonic 15 | def one_line_combinations(): 16 | """print out all 4-digit numbers""" 17 | numbers = [str(i).zfill(4) for i in range(10000)] 18 | print(numbers) 19 | -------------------------------------------------------------------------------- /nslookup_check.py: -------------------------------------------------------------------------------- 1 | # Script Name : nslookup_check.py 2 | # Author : Craig Richards 3 | # Created : 5th January 2012 4 | # Last Modified : 5 | # Version : 1.0 6 | 7 | # Modifications : 8 | 9 | # Description : This very simple script opens the file server_list.txt and then does a nslookup for each one to check the DNS entry 10 | 11 | import subprocess # Import the subprocess module 12 | 13 | for server in open("server_list.txt"): # Open the file and read each line 14 | subprocess.Popen( 15 | ("nslookup " + server) 16 | ) # Run the nslookup command for each server in the list 17 | -------------------------------------------------------------------------------- /FIND FACTORIAL OF A NUMBER.py: -------------------------------------------------------------------------------- 1 | # Python program to find the factorial of a number provided by the user. 2 | 3 | def factorial(n): 4 | if n < 0: # factorial of number less than 0 is not possible 5 | return "Oops!Factorial Not Possible" 6 | elif n == 0: # 0! = 1; when n=0 it returns 1 to the function which is calling it previously. 7 | return 1 8 | else: 9 | return n*factorial(n-1) 10 | #Recursive function. At every iteration "n" is getting reduced by 1 until the "n" is equal to 0. 11 | 12 | n = int(input("Enter a number: ")) # asks the user for input 13 | print(factorial(n)) # function call 14 | -------------------------------------------------------------------------------- /RandomDice.py: -------------------------------------------------------------------------------- 1 | # GGearing 01/10/19 2 | # Random Dice Game using Tkinter 3 | # Tkinter is used for Making Using GUI in Python Program! 4 | # randint provides you with a random number within your given range! 5 | from random import randint 6 | from tkinter import * 7 | 8 | # Function to rool the dice 9 | def roll(): 10 | text.delete(0.0, END) 11 | text.insert(END, str(randint(1, 100))) 12 | 13 | 14 | # Defining our GUI 15 | window = Tk() 16 | text = Text(window, width=3, height=1) 17 | buttonA = Button(window, text="Press to roll!", command=roll) 18 | text.pack() 19 | buttonA.pack() 20 | # End Of The Program! 21 | -------------------------------------------------------------------------------- /rotatelist.py: -------------------------------------------------------------------------------- 1 | N = int(input("Enter The Size Of Array")) 2 | list = [] 3 | for i in range(0, N): 4 | temp = int(input("Enter The Intger Numbers")) 5 | list.append(temp) 6 | 7 | 8 | # Rotating Arrays Using Best Way: 9 | # Left Rotation Of The List. 10 | # Let's say we want to print list after its d number of rotations. 11 | 12 | finalList = [] 13 | d = int(input("Enter The Number Of Times You Want To Rotate The Array")) 14 | 15 | for i in range(0, N): 16 | finalList.append(list[(i + d) % N]) 17 | 18 | print(finalList) 19 | 20 | # This Method holds the timeComplexity of O(N) and Space Complexity of O(N) 21 | -------------------------------------------------------------------------------- /binary_search_trees/search_in_bst.py: -------------------------------------------------------------------------------- 1 | def search(root, val): 2 | """ This function searches for a node with value val in the BST and returns True if found, False otherwise""" 3 | 4 | # If the tree is empty, return False 5 | if root == None: 6 | return False 7 | 8 | # If the root value is equal to the value to be searched, return True 9 | if root.data == val: 10 | return True 11 | 12 | # If the value to be searched is less than the root value, search in the left subtree 13 | if root.data > val: 14 | return search(root.left, val) 15 | return search(root.right, val) -------------------------------------------------------------------------------- /cartesian_product.py: -------------------------------------------------------------------------------- 1 | """Cartesian Product of Two Lists.""" 2 | 3 | # Import 4 | from itertools import product 5 | 6 | 7 | # Cartesian Product of Two Lists 8 | def cartesian_product(list1, list2): 9 | """Cartesian Product of Two Lists.""" 10 | for _i in list1: 11 | for _j in list2: 12 | print((_i, _j), end=' ') 13 | 14 | 15 | # Main 16 | if __name__ == '__main__': 17 | list1 = input().split() 18 | list2 = input().split() 19 | 20 | # Convert to ints 21 | list1 = [int(i) for i in list1] 22 | list2 = [int(i) for i in list2] 23 | 24 | cartesian_product(list1, list2) 25 | 26 | -------------------------------------------------------------------------------- /password_checker.py: -------------------------------------------------------------------------------- 1 | import time 2 | pwd="AKS2608" #any password u want to set 3 | 4 | def IInd_func(): 5 | count1=0 6 | for j in range(5): 7 | a=0 8 | count=0 9 | user_pwd = input("") #password you remember 10 | for i in range(len(pwd)): 11 | if user_pwd[i] == pwd[a]: #comparing remembered pwd with fixed pwd 12 | a +=1 13 | count+=1 14 | if count==len(pwd): 15 | print("correct pwd") 16 | break 17 | else: 18 | count1 += 1 19 | print("not correct") 20 | if count1==5: 21 | time.sleep(30) 22 | IInd_func() 23 | 24 | IInd_func() 25 | -------------------------------------------------------------------------------- /stone_paper_scissor/utils.py: -------------------------------------------------------------------------------- 1 | def validate(hand): 2 | if hand < 0 or hand > 2: 3 | return False 4 | return True 5 | 6 | 7 | def print_hand(hand, name="Guest"): 8 | hands = ["Rock", "Paper", "Scissors"] 9 | print(name + " picked: " + hands[hand]) 10 | 11 | 12 | def judge(player, computer): 13 | if player == computer: 14 | return "Draw" 15 | elif player == 0 and computer == 1: 16 | return "Lose" 17 | elif player == 1 and computer == 2: 18 | return "Lose" 19 | elif player == 2 and computer == 0: 20 | return "Lose" 21 | else: 22 | return "Win" 23 | -------------------------------------------------------------------------------- /primelib/Prime.txt: -------------------------------------------------------------------------------- 1 | # Program to check if a number is prime or not 2 | 3 | num = 407 4 | 5 | # To take input from the user 6 | #num = int(input("Enter a number: ")) 7 | 8 | # prime numbers are greater than 1 9 | if num > 1: 10 | # check for factors 11 | for i in range(2,num): 12 | if (num % i) == 0: 13 | print(num,"is not a prime number") 14 | print(i,"times",num//i,"is",num) 15 | break 16 | else: 17 | print(num,"is a prime number") 18 | 19 | # if input number is less than 20 | # or equal to 1, it is not prime 21 | else: 22 | print(num,"is not a prime number") 23 | -------------------------------------------------------------------------------- /binary_search_trees/root_to_leaf_paths.py: -------------------------------------------------------------------------------- 1 | def print_root_to_leaf_paths(root, path): 2 | """ This function prints all the root to leaf paths in a BST""" 3 | 4 | # If the tree is empty, return 5 | if root is None: 6 | return 7 | 8 | # Add the root value to the path 9 | path.append(root.data) 10 | if root.left is None and root.right is None: 11 | print(path) 12 | 13 | # Recursively print the root to leaf paths in the left and right subtrees 14 | else: 15 | print_root_to_leaf_paths(root.left, path) 16 | print_root_to_leaf_paths(root.right, path) 17 | path.pop() -------------------------------------------------------------------------------- /Python Program to Print the Fibonacci sequence.py: -------------------------------------------------------------------------------- 1 | # Program to display the Fibonacci sequence up to n-th term 2 | 3 | nterms = int(input("How many terms? ")) 4 | 5 | # first two terms 6 | n1, n2 = 0, 1 7 | count = 0 8 | 9 | # check if the number of terms is valid 10 | if nterms <= 0: 11 | print("Please enter a positive integer") 12 | elif nterms == 1: 13 | print("Fibonacci sequence upto",nterms,":") 14 | print(n1) 15 | else: 16 | print("Fibonacci sequence:") 17 | while count < nterms: 18 | print(n1) 19 | nth = n1 + n2 20 | # update values 21 | n1 = n2 22 | n2 = nth 23 | count += 1 24 | -------------------------------------------------------------------------------- /chaos.py: -------------------------------------------------------------------------------- 1 | # A simple program illustrating chaotic behaviour 2 | 3 | 4 | def main(): 5 | print("This program illustrates a chaotic function") 6 | 7 | while True: 8 | try: 9 | x = float((input("Enter a number between 0 and 1: "))) 10 | if 0 < x and x < 1: 11 | break 12 | else: 13 | print("Please enter correct number") 14 | except Exception as e: 15 | print("Please enter correct number") 16 | 17 | for i in range(10): 18 | x = 3.9 * x * (1 - x) 19 | print(x) 20 | 21 | 22 | if __name__ == "__main__": 23 | main() 24 | -------------------------------------------------------------------------------- /consonant.py: -------------------------------------------------------------------------------- 1 | my_string = input("Enter a string to count number of consonants: ") 2 | string_check = [ 3 | "a", 4 | "e", 5 | "i", 6 | "o", 7 | "u", 8 | "A", 9 | "E", 10 | "I", 11 | "O", 12 | "U", 13 | ] # list for checking vowels 14 | 15 | 16 | def count_con(string): 17 | c = 0 18 | for i in range(len(string)): 19 | if ( 20 | string[i] not in string_check 21 | ): # counter increases if the character is not vowel 22 | c += 1 23 | return c 24 | 25 | 26 | counter = count_con(my_string) 27 | print(f"Number of consonants in {my_string} is {counter}.") 28 | -------------------------------------------------------------------------------- /how to display the fibonacci sequence up to n-.py: -------------------------------------------------------------------------------- 1 | # Program to display the Fibonacci sequence up to n-th term 2 | 3 | nterms = int(input("How many terms? ")) 4 | 5 | # first two terms 6 | n1, n2 = 0, 1 7 | count = 0 8 | 9 | # check if the number of terms is valid 10 | if nterms <= 0: 11 | print("Please enter a positive integer") 12 | elif nterms == 1: 13 | print("Fibonacci sequence upto",nterms,":") 14 | print(n1) 15 | else: 16 | print("Fibonacci sequence:") 17 | while count < nterms: 18 | print(n1) 19 | nth = n1 + n2 20 | # update values 21 | n1 = n2 22 | n2 = nth 23 | count += 1 24 | -------------------------------------------------------------------------------- /next_number.py: -------------------------------------------------------------------------------- 1 | x, li, small, maxx, c = input(), list(), 0, 0, 1 2 | for i in range(len(x)): 3 | li.append(int(x[i])) 4 | for i in range(len(li) - 1, -1, -1): 5 | if i == 0: 6 | print("No Number Possible") 7 | c = 0 8 | break 9 | if li[i] > li[i - 1]: 10 | small = i - 1 11 | maxx = i 12 | break 13 | for i in range(small + 1, len(li)): 14 | if li[i] > li[small] and li[i] < li[maxx]: 15 | maxx = i 16 | li[small], li[maxx] = li[maxx], li[small] 17 | li = li[: small + 1] + sorted(li[small + 1 :]) 18 | if c: 19 | for i in range(len(li)): 20 | print(li[i], end="") 21 | -------------------------------------------------------------------------------- /text-to-audio/text-file-to-audio.py: -------------------------------------------------------------------------------- 1 | from gtts import gTTS 2 | import os 3 | 4 | # Enter the name of your text file 5 | mytextfile = "hello.txt" 6 | 7 | # Specify the language in which you want your audio 8 | language = "en" 9 | 10 | # Get the contents of your file 11 | with open(mytextfile, 'r') as f: 12 | mytext = f.read() 13 | f.close() 14 | 15 | # Create an instance of gTTS class 16 | myobj = gTTS(text=mytext, lang=language, slow=False) 17 | 18 | # Method to create your audio file in mp3 format 19 | myobj.save("hello.mp3") 20 | print("Audio Saved") 21 | 22 | # This will play your audio file 23 | os.system("mpg321 hello.mp3") 24 | -------------------------------------------------------------------------------- /binary_search_trees/insert_in_bst.py: -------------------------------------------------------------------------------- 1 | from tree_node import Node 2 | def insert(root,val): 3 | 4 | """ This function inserts a node with value val into the BST""" 5 | 6 | # If the tree is empty, create a new node 7 | if root is None: 8 | return Node(val) 9 | 10 | # If the value to be inserted is less than the root value, insert in the left subtree 11 | if val < root.data: 12 | root.left = insert(root.left,val) 13 | 14 | # If the value to be inserted is greater than the root value, insert in the right subtree 15 | else: 16 | root.right = insert(root.right,val) 17 | return root -------------------------------------------------------------------------------- /brickout-game/README.md: -------------------------------------------------------------------------------- 1 | # Brickout-Game in pygame 2 | 3 | This is a simple brickout-game. It's includes ball, paddle, brick wall 4 | and additional collision detection between these objects. Furthermore, logic for winning and losing and 5 | scoring. The game is written in **Python 2**. 6 | 7 | You start the game with ```python game.py``` 8 | 9 | The game runs with 60 frames per second. 10 | 11 | I used a code sample for the basic structure of pygame from this site [http://programarcadegames.com/](http://programarcadegames.com/) 12 | The site contains a comprehensive introduction in Python and Pygame. In addition many many examples. 13 | 14 | -------------------------------------------------------------------------------- /greaterno.py: -------------------------------------------------------------------------------- 1 | # Python program to find the largest number among the three input numbers 2 | 3 | # change the values of num1, num2 and num3 4 | # for a different result 5 | num1 = 10 6 | num2 = 14 7 | num3 = 12 8 | 9 | # uncomment following lines to take three numbers from user 10 | #num1 = float(input("Enter first number: ")) 11 | #num2 = float(input("Enter second number: ")) 12 | #num3 = float(input("Enter third number: ")) 13 | 14 | if (num1 >= num2) and (num1 >= num3): 15 | largest = num1 16 | elif (num2 >= num1) and (num2 >= num3): 17 | largest = num2 18 | else: 19 | largest = num3 20 | 21 | print("The largest number is", largest) 22 | -------------------------------------------------------------------------------- /wikipedia.py: -------------------------------------------------------------------------------- 1 | import wikipedia 2 | from tkinter import * 3 | from tkinter.messagebox import showinfo 4 | 5 | win = Tk() # objek 6 | win.title("WIKIPEDIA") 7 | win.geometry("200x70") # function 8 | 9 | # function 10 | def search_wiki(): 11 | search = entry.get() 12 | Hasil = wikipedia.summary(search) 13 | showinfo("Hasil Pencarian", Hasil) 14 | 15 | 16 | label = Label(win, text="Wikipedia Search :") 17 | label.grid(row=0, column=0) 18 | 19 | entry = Entry(win) 20 | entry.grid(row=1, column=0) 21 | 22 | button = Button(win, text="Search", command=search_wiki) 23 | button.grid(row=1, column=1, padx=10) 24 | 25 | win.mainloop() 26 | -------------------------------------------------------------------------------- /1 File handle/File handle binary/search record in binary file.py: -------------------------------------------------------------------------------- 1 | # binary file to search a given record 2 | 3 | import pickle 4 | 5 | 6 | def binary_search(): 7 | with open("studrec.dat", "rb") as F: 8 | # your file path will be different 9 | search = 0 10 | rno = int(input("Enter the roll number of the student")) 11 | 12 | for i in pickle.load(F): 13 | if i[0] == rno: 14 | print(f"Record found successfully\n{i}") 15 | search = 1 16 | 17 | if search == 0: 18 | print("Sorry! record not found") 19 | 20 | 21 | binary_search() 22 | -------------------------------------------------------------------------------- /findlargestno.md: -------------------------------------------------------------------------------- 1 | # Python program to find the largest number among the three input numbers 2 | 3 | # change the values of num1, num2 and num3 4 | # for a different result 5 | num1 = 10 6 | num2 = 14 7 | num3 = 12 8 | 9 | # uncomment following lines to take three numbers from user 10 | #num1 = float(input("Enter first number: ")) 11 | #num2 = float(input("Enter second number: ")) 12 | #num3 = float(input("Enter third number: ")) 13 | 14 | if (num1 >= num2) and (num1 >= num3): 15 | largest = num1 16 | elif (num2 >= num1) and (num2 >= num3): 17 | largest = num2 18 | else: 19 | largest = num3 20 | 21 | print("The largest number is", largest) 22 | -------------------------------------------------------------------------------- /Shortest Distance between Two Lines.py: -------------------------------------------------------------------------------- 1 | import math 2 | import numpy as NP 3 | 4 | LC1 = eval(input("Enter DRs of Line 1 : ")) 5 | LP1 = eval(input("Enter Coordinate through which Line 1 passes : ")) 6 | LC2 = eval(input("Enter DRs of Line 2 : ")) 7 | LP2 = eval(input("Enter Coordinate through which Line 2 passes : ")) 8 | a1, b1, c1, a2, b2, c2 = LC1[0], LC1[1], LC1[2], LC2[0], LC2[1], LC2[2] 9 | x = NP.array( 10 | [[LP2[0] - LP1[0], LP2[1] - LP1[1], LP2[2] - LP1[2]], [a1, b1, c1], [a2, b2, c2]] 11 | ) 12 | y = math.sqrt( 13 | (((b1 * c2) - (b2 * c1)) ** 2) 14 | + (((c1 * a2) - (c2 * a1)) ** 2) 15 | + (((a1 * b2) - (b1 * a2)) ** 2) 16 | ) 17 | -------------------------------------------------------------------------------- /Python Program for Product of unique prime factors of a number.py: -------------------------------------------------------------------------------- 1 | # Python program to find sum of given 2 | # series. 3 | 4 | def productPrimeFactors(n): 5 | product = 1 6 | 7 | for i in range(2, n+1): 8 | if (n % i == 0): 9 | isPrime = 1 10 | 11 | for j in range(2, int(i/2 + 1)): 12 | if (i % j == 0): 13 | isPrime = 0 14 | break 15 | 16 | # condition if \'i\' is Prime number 17 | # as well as factor of num 18 | if (isPrime): 19 | product = product * i 20 | 21 | return product 22 | 23 | 24 | 25 | # main() 26 | n = 44 27 | print (productPrimeFactors(n)) 28 | 29 | # Contributed by _omg 30 | -------------------------------------------------------------------------------- /Patterns/patterns.py: -------------------------------------------------------------------------------- 1 | # Lets say we want to print a combination of stars as shown below. 2 | 3 | # * 4 | # * * 5 | # * * * 6 | # * * * * 7 | # * * * * * 8 | 9 | 10 | # Let's say we want to print pattern which is opposite of above: 11 | # * * * * * 12 | # * * * * 13 | # * * * 14 | # * * 15 | # * 16 | 17 | def main(): 18 | lines = int(input("Enter no.of lines: ")) 19 | pattern(lines) 20 | 21 | def pattern(lines): 22 | for i in range(1,lines+1): 23 | print("* "*i) 24 | print() 25 | for i in range(lines): 26 | print(" "*i,"* "*(lines-i)) 27 | 28 | if __name__ == "__main__": 29 | main() 30 | -------------------------------------------------------------------------------- /videodownloder.py: -------------------------------------------------------------------------------- 1 | from pytube import YouTube 2 | 3 | #location where you save. 4 | PATH = "E:/" #to_do 5 | 6 | #link of video. 7 | link=["https://www.youtube.com/watch?v=p8FuTenSWPI", 8 | "https://www.youtube.com/watch?v=JWbnEt3xuos" 9 | ]#list of video links. 10 | for i in link: 11 | try: 12 | yt = YouTube(i) 13 | except: 14 | print("Connection Error") #to handle exception 15 | 16 | #check files with "mp4" extension 17 | mp4files = yt.filter('mp4') 18 | 19 | d_video = yt.get(mp4files[-1].extension,mp4files[-1].resolution) 20 | try: 21 | d_video.download(PATH) 22 | except: 23 | print("Some Error!") 24 | print('Task Completed!') 25 | -------------------------------------------------------------------------------- /1 File handle/File handle text/question 6.py: -------------------------------------------------------------------------------- 1 | """Write a function in python to count the number of lowercase 2 | alphabets present in a text file “happy.txt""" 3 | 4 | from counter import Counter 5 | 6 | def lowercase(): 7 | 8 | with open("happy.txt") as F: 9 | word_counter = Counter(F.read()) 10 | 11 | print(f"The total number of lower case letters are {word_counter.get_total_lower()}") 12 | print(f"The total number of upper case letters are {word_counter.get_total_upper()}") 13 | print(f"The total number of letters are {word_counter.get_total()}") 14 | 15 | if __name__ == "__main__": 16 | lowercase() 17 | -------------------------------------------------------------------------------- /divisors_of_a_number.py: -------------------------------------------------------------------------------- 1 | a = 0 2 | while a<= 0 : 3 | number_to_divide = input("choose the number to divide -->") 4 | try : 5 | a = int(number_to_divide) 6 | except ValueError : 7 | a = 0 8 | if a <= 0 : 9 | print('choose a number grether than 0') 10 | list_number_divided = [] 11 | 12 | for number in range(1,a + 1) : 13 | b = a % number 14 | if b == 0 : 15 | list_number_divided.append(number) 16 | print('\nthe number ' + number_to_divide + ' can be divided by:') 17 | for item in list_number_divided : 18 | print(f'{item}') 19 | if len(list_number_divided) <= 2 : 20 | print(number_to_divide + ' is a prime number') -------------------------------------------------------------------------------- /python_webscraper.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from bs4 import BeautifulSoup 3 | # Make a request on to your website 4 | page = requests.get("Paste your Website Domain here") 5 | soup = BeautifulSoup(page.content, 'html.parser') 6 | 7 | # Create all_h1_tags as empty list 8 | all_h1_tags = [] 9 | 10 | # Set all_h1_tags to all h1 tags of the soup 11 | for element in soup.select('h1'): 12 | all_h1_tags.append(element.text) 13 | 14 | # Create seventh_p_text and set it to 7th p element text of the page 15 | seventh_p_text = soup.select('p')[6].text 16 | 17 | print(all_h1_tags, seventh_p_text) 18 | 19 | # print all h1 elements and the text of the website on your console 20 | -------------------------------------------------------------------------------- /text_to_audio/author_name_NC.txt: -------------------------------------------------------------------------------- 1 | 2 | __ _ _ _ _ ___ _ _ 3 | /\ \ \(_)| |_ | | __ __ _ _ __ ___ | |__ / __\| |__ ___ _ _ _ __ __ _ ___ (_) __ _ 4 | / \/ /| || __|| |/ / / _` || '__|/ __|| '_ \ / / | '_ \ / _ \ | | | || '__| / _` |/ __|| | / _` | 5 | / /\ / | || |_ | < | (_| || | \__ \| | | | / /___ | | | || (_) || |_| || | | (_| |\__ \| || (_| | 6 | \_\ \/ |_| \__||_|\_\ \__,_||_| |___/|_| |_| \____/ |_| |_| \___/ \__,_||_| \__,_||___/|_| \__,_| 7 | 8 | -------------------------------------------------------------------------------- /send_message_automation/author_name_NC.txt: -------------------------------------------------------------------------------- 1 | 2 | __ _ _ _ _ ___ _ _ 3 | /\ \ \(_)| |_ | | __ __ _ _ __ ___ | |__ / __\| |__ ___ _ _ _ __ __ _ ___ (_) __ _ 4 | / \/ /| || __|| |/ / / _` || '__|/ __|| '_ \ / / | '_ \ / _ \ | | | || '__| / _` |/ __|| | / _` | 5 | / /\ / | || |_ | < | (_| || | \__ \| | | | / /___ | | | || (_) || |_| || | | (_| |\__ \| || (_| | 6 | \_\ \/ |_| \__||_|\_\ \__,_||_| |___/|_| |_| \____/ |_| |_| \___/ \__,_||_| \__,_||___/|_| \__,_| 7 | 8 | -------------------------------------------------------------------------------- /string_rotation.py: -------------------------------------------------------------------------------- 1 | # This program rotates a given string letters by letters 2 | # for example: 3 | # input: "Tie" 4 | # Output: ["ieT", "eTi"] 5 | 6 | 7 | def rotate(n): 8 | a = list(n) 9 | if len(a) == 0: 10 | return print([]) 11 | l = [] 12 | for i in range(1, len(a) + 1): 13 | a = [a[(i + 1) % (len(a))] for i in range(0, len(a))] 14 | l += ["".join(a)] 15 | print(l) 16 | 17 | 18 | string = str(input()) 19 | print("Your input is :", string) 20 | print("The rotation is :") 21 | rotate(string) 22 | 23 | 24 | # Input : Python 25 | # output : 26 | # The rotation is : 27 | # ['ythonp', 'thonpy', 'honpyt', 'onpyth', 'npytho', 'python'] 28 | -------------------------------------------------------------------------------- /Strings.py: -------------------------------------------------------------------------------- 1 | String1 = "Welcome to Malya's World" 2 | print("String with the use of Single Quotes: ") 3 | print(String1) 4 | 5 | # Creating a String 6 | # with double Quotes 7 | String1 = "I'm a TechGeek" 8 | print("\nString with the use of Double Quotes: ") 9 | print(String1) 10 | 11 | # Creating a String 12 | # with triple Quotes 13 | String1 = '''I'm Malya and I live in a world of "TechGeeks"''' 14 | print("\nString with the use of Triple Quotes: ") 15 | print(String1) 16 | 17 | # Creating String with triple 18 | # Quotes allows multiple lines 19 | String1 = """Smile 20 | For 21 | Life""" 22 | print("\nCreating a multiline String: ") 23 | print(String1) 24 | -------------------------------------------------------------------------------- /chicks_n_rabs.py: -------------------------------------------------------------------------------- 1 | """ 2 | Author Anurag Kumar(mailto:anuragkumarak95@gmail.com) 3 | 4 | Module to solve a classic ancient Chinese puzzle: 5 | We count 35 heads and 94 legs among the chickens and rabbits in a farm. 6 | How many rabbits and how many chickens do we have? 7 | 8 | """ 9 | 10 | 11 | def solve(num_heads, num_legs): 12 | ns = "No solutions!" 13 | for i in range(num_heads + 1): 14 | j = num_heads - i 15 | if 2 * i + 4 * j == num_legs: 16 | return i, j 17 | return ns, ns 18 | 19 | 20 | if __name__ == "__main__": 21 | numheads = 35 22 | numlegs = 94 23 | 24 | solutions = solve(numheads, numlegs) 25 | print(solutions) 26 | -------------------------------------------------------------------------------- /Polyline.py: -------------------------------------------------------------------------------- 1 | # Polyline drawing in codeskulptor 2 | 3 | import simplegui 4 | 5 | polyline = [] 6 | 7 | 8 | def click(pos): 9 | global polyline 10 | polyline.append(pos) 11 | 12 | 13 | def clear(): 14 | global polyline 15 | polyline = [] 16 | 17 | 18 | def draw(canvas): 19 | if len(polyline) == 1: 20 | canvas.draw_point(polyline[0], "White") 21 | for i in range(1, len(polyline)): 22 | canvas.draw_line(polyline[i - 1], polyline[i], 2, "White") 23 | 24 | 25 | frame = simplegui.create_frame("Echo click", 300, 200) 26 | frame.set_mouseclick_handler(click) 27 | frame.set_draw_handler(draw) 28 | frame.add_button("Clear", clear) 29 | 30 | frame.start() 31 | -------------------------------------------------------------------------------- /Sorting Algorithms/Linear_Insertion_Sort.py: -------------------------------------------------------------------------------- 1 | def Linear_Search(Test_arr, val): 2 | index = 0 3 | for i in range(len(Test_arr)): 4 | if val > Test_arr[i]: 5 | index = i + 1 6 | return index 7 | 8 | 9 | def Insertion_Sort(Test_arr): 10 | for i in range(1, len(Test_arr)): 11 | val = Test_arr[i] 12 | j = Linear_Search(Test_arr[:i], val) 13 | Test_arr.pop(i) 14 | Test_arr.insert(j, val) 15 | return Test_arr 16 | 17 | 18 | if __name__ == "__main__": 19 | Test_list = input("Enter the list of Numbers: ").split() 20 | Test_list = [int(i) for i in Test_list] 21 | print(f"Binary Insertion Sort: {Insertion_Sort(Test_list)}") 22 | -------------------------------------------------------------------------------- /UI-Apps/clock.py: -------------------------------------------------------------------------------- 1 | import tkinter 2 | 3 | # retrieve system's time 4 | from time import strftime 5 | 6 | # ------------------main code----------------------- 7 | # initializing the main UI object 8 | top = tkinter.Tk() 9 | # setting title of the App 10 | top.title("Clock") 11 | # restricting the resizable property 12 | top.resizable(0, 0) 13 | 14 | 15 | def time(): 16 | string = strftime("%H:%M:%S %p") 17 | clockTime.config(text=string) 18 | clockTime.after(1000, time) 19 | 20 | 21 | clockTime = tkinter.Label( 22 | top, font=("calibri", 40, "bold"), background="black", foreground="white" 23 | ) 24 | 25 | clockTime.pack(anchor="center") 26 | time() 27 | 28 | 29 | top.mainloop() 30 | -------------------------------------------------------------------------------- /convert_wind_direction_to_degrees.py: -------------------------------------------------------------------------------- 1 | def degrees_to_compass(degrees): 2 | directions = ["N", "NE", "E", "SE", "S", "SW", "W", "NW"] 3 | index = round(degrees / 45) % 8 4 | return directions[index] 5 | 6 | # Taking input from the user 7 | while True: 8 | try: 9 | degrees = float(input("Enter the wind direction in degrees (0-359): ")) 10 | if degrees < 0 or degrees >= 360: 11 | raise ValueError("Degrees must be between 0 and 359") 12 | break 13 | except ValueError as ve: 14 | print(f"Error: {ve}") 15 | continue 16 | 17 | 18 | compass_direction = degrees_to_compass(degrees) 19 | print(f"{degrees} degrees is {compass_direction}") 20 | -------------------------------------------------------------------------------- /longest_increasing_subsequence_length.py: -------------------------------------------------------------------------------- 1 | """ 2 | Author- DIWAKAR JAISWAL 3 | find lenth Longest increasing subsequence of given array. 4 | """ 5 | 6 | 7 | def lis(a): 8 | n = len(a) 9 | # initialize ans array same lenth as 1 10 | ans = [1] * n 11 | for i in range(1, n): 12 | # now compare with first index to that index 13 | for j in range(i): 14 | if a[i] > a[j] and ans[i] < ans[j] + 1: 15 | ans[i] = ans[j] + 1 16 | return max(ans) 17 | 18 | 19 | a = [1, 3, 2, 6, 4] 20 | 21 | # longest increasing subsequence=[{1<3<6},{1<3<4},{1<2<6},{1<2<4}] length is 3 22 | 23 | print("Maximum Length of longest increasing subsequence ", lis(a)) 24 | -------------------------------------------------------------------------------- /Sorting Algorithms/Bubble_sort.py: -------------------------------------------------------------------------------- 1 | def bubble_sort(Lists): 2 | for i in range(len(Lists)): 3 | for j in range(len(Lists) - 1): 4 | # We check whether the adjecent number is greater or not 5 | if Lists[j] > Lists[j + 1]: 6 | Lists[j], Lists[j + 1] = Lists[j + 1], Lists[j] 7 | 8 | 9 | # Lets the user enter values of an array and verify by himself/herself 10 | array = [] 11 | array_length = int( 12 | input("Enter the number of elements of array or enter the length of array") 13 | ) 14 | for i in range(array_length): 15 | value = int(input("Enter the value in the array")) 16 | array.append(value) 17 | 18 | bubble_sort(array) 19 | print(array) 20 | -------------------------------------------------------------------------------- /create password validity in python.py: -------------------------------------------------------------------------------- 1 | import time 2 | pwd=input("Enter your password: ") #any password u want to set 3 | 4 | def IInd_func(): 5 | count1=0 6 | for j in range(5): 7 | a=0 8 | count=0 9 | user_pwd = input("Enter remember password: ") #password you remember 10 | for i in range(len(pwd)): 11 | if user_pwd[i] == pwd[a]: #comparing remembered pwd with fixed pwd 12 | a +=1 13 | count+=1 14 | if count==len(pwd): 15 | print("correct pwd") 16 | break 17 | else: 18 | count1 += 1 19 | print("not correct") 20 | if count1==5: 21 | time.sleep(30) 22 | IInd_func() 23 | 24 | IInd_func() -------------------------------------------------------------------------------- /1 File handle/File handle binary/File handle binary read (record in non list form).py: -------------------------------------------------------------------------------- 1 | import pickle 2 | 3 | 4 | def binary_read(): 5 | with open("studrec.dat","rb") as b: 6 | stud = pickle.load(b) 7 | print(stud) 8 | 9 | # prints the whole record in nested list format 10 | print("contents of binary file") 11 | 12 | for ch in stud: 13 | 14 | print(ch) # prints one of the chosen rec in list 15 | 16 | rno = ch[0] 17 | rname = ch[1] # due to unpacking the val not printed in list format 18 | rmark = ch[2] 19 | 20 | print(rno, rname, rmark, end="\t") 21 | 22 | 23 | binary_read() 24 | -------------------------------------------------------------------------------- /Image_resize.py: -------------------------------------------------------------------------------- 1 | def jpeg_res(filename): 2 | """"This function prints the resolution of the jpeg image file passed into it""" 3 | 4 | # open image for reading in binary mode 5 | with open(filename,'rb') as img_file: 6 | 7 | # height of image (in 2 bytes) is at 164th position 8 | img_file.seek(163) 9 | 10 | # read the 2 bytes 11 | a = img_file.read(2) 12 | 13 | # calculate height 14 | height = (a[0] << 8) + a[1] 15 | 16 | # next 2 bytes is width 17 | a = img_file.read(2) 18 | 19 | # calculate width 20 | width = (a[0] << 8) + a[1] 21 | 22 | print("The resolution of the image is",width,"x",height) 23 | 24 | jpeg_res("img1.jpg") 25 | -------------------------------------------------------------------------------- /pyauto.py: -------------------------------------------------------------------------------- 1 | # Author-Slayking1965 2 | # email-kingslayer8509@gmail.com 3 | import random 4 | import pyautogui 5 | import string 6 | 7 | 8 | chars = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" 9 | 10 | chars = string.printable 11 | chars_list = list(chars) 12 | 13 | 14 | password = pyautogui.password("Enter a password : ") 15 | 16 | guess_password = "" 17 | 18 | while guess_password != password: 19 | guess_password = random.choices(chars_list, k=len(password)) 20 | 21 | print("<==================" + str(guess_password) + "==================>") 22 | 23 | if guess_password == list(password): 24 | print("Your password is : " + "".join(guess_password)) 25 | break 26 | -------------------------------------------------------------------------------- /FizzBuzz.py: -------------------------------------------------------------------------------- 1 | # FizzBuzz 2 | # A program that prints the numbers from 1 to num (User given number)! 3 | # For multiples of ‘3’ print “Fizz” instead of the number. 4 | # For the multiples of ‘5’ print “Buzz”. 5 | # If the number is divisible by both 3 and 5 then print "FizzBuzz". 6 | # If none of the given conditions are true then just print the number! 7 | 8 | 9 | def FizzBuzz(num): 10 | for i in range(1, num + 1): 11 | if i % 3 == 0 and i % 5 == 0: 12 | print("FizzBuzz") 13 | elif i % 3 == 0: 14 | print("Fizz") 15 | elif i % 5 == 0: 16 | print("Buzz") 17 | else: 18 | print(i) 19 | 20 | 21 | 22 | FizzBuzz(20) # prints FizzBuzz up to 20 23 | -------------------------------------------------------------------------------- /LETTER GUESSER: -------------------------------------------------------------------------------- 1 | import random 2 | import string 3 | 4 | ABCS = string.ascii_lowercase 5 | ABCS = list(ABCS) 6 | 7 | play = True 8 | 9 | compChosse = random.choice(ABCS) 10 | 11 | print(":guess the letter (only 10 guesses):") 12 | userInput = input("guess:") 13 | 14 | failed = 10 15 | 16 | while failed > 0: 17 | if userInput == compChosse: 18 | print("---------->") 19 | print("You are correct!") 20 | print("---------->") 21 | print("Your guesses: " + str(10 - failed)) 22 | break 23 | 24 | elif userInput != compChosse: 25 | failed = failed - 1 26 | 27 | print(":no your wrong: " + "left: " + str(failed)) 28 | 29 | userInput = input("guess:") 30 | 31 | if failed == 0: 32 | print("out of guesses") 33 | -------------------------------------------------------------------------------- /bodymass.py: -------------------------------------------------------------------------------- 1 | kilo = float (input("kilonuzu giriniz(örnek: 84.9): ")) 2 | boy = float (input("Boyunuzu m cinsinden giriniz: ")) 3 | 4 | vki = (kilo / (boy**2)) 5 | 6 | if vki < 18.5: 7 | print(f"vucut kitle indeksiniz: {vki} zayıfsınız.") 8 | elif vki < 25: 9 | print (f"vucut kitle indeksiniz: {vki} normalsiniz.") 10 | elif vki < 30: 11 | print (f"vucut kitle indeksiniz: {vki} fazla kilolusunuz.") 12 | elif vki < 35: 13 | print (f"vucut kitle indeksiniz: {vki} 1. derece obezsiniz") 14 | elif vki < 40: 15 | print (f"vucut kitle indeksiniz: {vki} 2.derece obezsiniz.") 16 | elif vki >40: 17 | print (f"vucut kitle indeksiniz: {vki} 3.derece obezsiniz.") 18 | else: 19 | print("Yanlış değer girdiniz.") 20 | -------------------------------------------------------------------------------- /CountMillionCharacters-2.0.py: -------------------------------------------------------------------------------- 1 | """Get the number of each character in any given text. 2 | Inputs: 3 | A txt file -- You will be asked for an input file. Simply input the name 4 | of the txt file in which you have the desired text. 5 | """ 6 | 7 | import collections 8 | import pprint 9 | 10 | 11 | def main(): 12 | file_input = input("File Name: ") 13 | try: 14 | with open(file_input, "r") as info: 15 | count = collections.Counter(info.read().upper()) 16 | except FileNotFoundError: 17 | print("Please enter a valid file name.") 18 | main() 19 | 20 | value = pprint.pformat(count) 21 | print(value) 22 | exit() 23 | 24 | 25 | if __name__ == "__main__": 26 | main() 27 | -------------------------------------------------------------------------------- /Email-Automation.py: -------------------------------------------------------------------------------- 1 | import smtplib 2 | from email.mime.multipart import MIMEMultipart 3 | from email.mime.text import MIMEText 4 | 5 | fro_add = "dilipvijjapu@gmail.com" 6 | to_add = "vijjapudilip@gmail.com" 7 | 8 | message = MIMEMultipart() 9 | message["From"] = fro_add 10 | message["To"] = ",".join(to_add) 11 | message["subject"] = "Testinf mail" 12 | 13 | body = "Hai this is dilip ,How are you" 14 | 15 | message.attach(MIMEText(body, "plain")) 16 | 17 | email = " " 18 | password = " " 19 | 20 | mail = smtplib.SMTP("smtp.gmail.com", 587) 21 | mail.ehlo() 22 | mail.starttls() 23 | mail.login(email, password) 24 | text = message.as_string() 25 | mail.sendmail(fro_add, to_add, text) 26 | mail.quit() 27 | -------------------------------------------------------------------------------- /Extract_Text_from_image.py: -------------------------------------------------------------------------------- 1 | # extract text from a img and its coordinates using the pytesseract module 2 | import cv2 3 | import pytesseract 4 | 5 | # You need to add tesseract binary dependency to system variable for this to work 6 | 7 | img = cv2.imread("img.png") 8 | # We need to convert the img into RGB format 9 | img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) 10 | 11 | hI, wI, k = img.shape 12 | print(pytesseract.image_to_string(img)) 13 | boxes = pytesseract.image_to_boxes(img) 14 | for b in boxes.splitlines(): 15 | b = b.split(" ") 16 | x, y, w, h = int(b[1]), int(b[2]), int(b[3]), int(b[4]) 17 | cv2.rectangle(img, (x, hI - y), (w, hI - h), (0, 0, 255), 0.2) 18 | 19 | cv2.imshow("img", img) 20 | cv2.waitKey(0) 21 | -------------------------------------------------------------------------------- /FindingResolutionOfAnImage.py: -------------------------------------------------------------------------------- 1 | def jpeg_res(filename): 2 | """"This function prints the resolution of the jpeg image file passed into it""" 3 | 4 | # open image for reading in binary mode 5 | with open(filename,'rb') as img_file: 6 | 7 | # height of image (in 2 bytes) is at 164th position 8 | img_file.seek(163) 9 | 10 | # read the 2 bytes 11 | a = img_file.read(2) 12 | 13 | # calculate height 14 | height = (a[0] << 8) + a[1] 15 | 16 | # next 2 bytes is width 17 | a = img_file.read(2) 18 | 19 | # calculate width 20 | width = (a[0] << 8) + a[1] 21 | 22 | print("The resolution of the image is",width,"x",height) 23 | 24 | jpeg_res("img1.jpg") 25 | -------------------------------------------------------------------------------- /size(resolution)image.py: -------------------------------------------------------------------------------- 1 | def jpeg_res(filename): 2 | """ "This function prints the resolution of the jpeg image file passed into it""" 3 | 4 | # open image for reading in binary mode 5 | with open(filename, "rb") as img_file: 6 | 7 | # height of image (in 2 bytes) is at 164th position 8 | img_file.seek(163) 9 | 10 | # read the 2 bytes 11 | a = img_file.read(2) 12 | 13 | # calculate height 14 | height = (a[0] << 8) + a[1] 15 | 16 | # next 2 bytes is width 17 | a = img_file.read(2) 18 | 19 | # calculate width 20 | width = (a[0] << 8) + a[1] 21 | 22 | print("The resolution of the image is", width, "x", height) 23 | 24 | 25 | jpeg_res("img1.jpg") 26 | -------------------------------------------------------------------------------- /VoiceRepeater/__main__.py: -------------------------------------------------------------------------------- 1 | import time 2 | 3 | import speech_recognition as sr 4 | import os 5 | import playsound 6 | import shutil 7 | 8 | shutil.rmtree("spoken") 9 | os.mkdir("spoken") 10 | 11 | speeches = [] 12 | 13 | 14 | def callback(recognizer, audio): 15 | with open("spoken/" + str(len(speeches)) + ".wav", "wb") as file: 16 | file.write(audio.get_wav_data()) 17 | 18 | playsound.playsound("spoken/" + str(len(speeches)) + ".wav") 19 | speeches.append(1) 20 | print("____") 21 | 22 | 23 | r = sr.Recognizer() 24 | m = sr.Microphone() 25 | with m as source: 26 | r.adjust_for_ambient_noise(source) 27 | 28 | stop_listening = r.listen_in_background(m, callback) 29 | print("say:") 30 | while True: 31 | time.sleep(0.1) 32 | -------------------------------------------------------------------------------- /read_excel_file.py: -------------------------------------------------------------------------------- 1 | # extract number of rows using Python 2 | import xlrd 3 | 4 | # Give the location of the file 5 | loc = "sample.xlsx" 6 | wb = xlrd.open_workbook(loc) 7 | sheet = wb.sheet_by_index(0) 8 | sheet.cell_value(0, 0) 9 | # Extracting number of rows 10 | print(sheet.nrows) 11 | 12 | # extract number of columns in Python 13 | print(sheet.ncols) 14 | 15 | # extracting all columns name in Python 16 | for i in range(sheet.ncols): 17 | print(sheet.cell_value(0, i)) 18 | 19 | # extracting first column 20 | sheet = wb.sheet_by_index(0) 21 | for i in range(sheet.nrows): 22 | print(sheet.cell_value(i, 0)) 23 | 24 | # extract a particular row value 25 | sheet = wb.sheet_by_index(0) 26 | print(sheet.row_values(1)) 27 | -------------------------------------------------------------------------------- /SimpleStopWatch.py: -------------------------------------------------------------------------------- 1 | # Author: OMKAR PATHAK 2 | # This script helps to build a simple stopwatch application using Python's time module. 3 | 4 | import time 5 | 6 | print("Press ENTER to begin, Press Ctrl + C to stop") 7 | while True: 8 | try: 9 | input() # For ENTER. Use raw_input() if you are running python 2.x instead of input() 10 | starttime = time.time() 11 | print("Started") 12 | while True: 13 | print("Time Elapsed: ", round(time.time() - starttime, 0), "secs", end="\r") 14 | time.sleep(1) # 1 second delay 15 | except KeyboardInterrupt: 16 | print("Stopped") 17 | endtime = time.time() 18 | print("Total Time:", round(endtime - starttime, 2), "secs") 19 | break 20 | -------------------------------------------------------------------------------- /Sorting Algorithms/insertion_sort.py: -------------------------------------------------------------------------------- 1 | def insertion_sort(nums): 2 | # Start on the second element as we assume the first element is sorted 3 | for i in range(1, len(nums)): 4 | item_to_insert = nums[i] 5 | # And keep a reference of the index of the previous element 6 | j = i - 1 7 | # Move all items of the sorted segment forward if they are larger than 8 | # the item to insert 9 | while j >= 0 and nums[j] > item_to_insert: 10 | nums[j + 1] = nums[j] 11 | j -= 1 12 | # Insert the item 13 | nums[j + 1] = item_to_insert 14 | 15 | 16 | # Verify it works 17 | random_list_of_nums = [9, 1, 15, 28, 6] 18 | insertion_sort(random_list_of_nums) 19 | print(random_list_of_nums) 20 | -------------------------------------------------------------------------------- /List.py: -------------------------------------------------------------------------------- 1 | List = [] 2 | # List is Muteable 3 | # means value can be change 4 | List.insert(0, 5) #insertion takes place at mentioned index 5 | List.insert(1, 10) 6 | List.insert(0, 6) 7 | print(List) 8 | List.remove(6) 9 | List.append(9) #insertion takes place at last 10 | List.append(1) 11 | List.sort() #arranges element in ascending order 12 | print(List) 13 | List.pop() 14 | List.reverse() 15 | print(List) 16 | """ 17 | List.append(1) 18 | print(List) 19 | List.append(2) 20 | print(List) 21 | List.insert(1 , 3) 22 | print(List) 23 | """ 24 | 25 | list2 = [2, 3, 7, 5, 10, 17, 12, 4, 1, 13] 26 | for i in list2: 27 | if i % 2 == 0: 28 | print(i) 29 | """ 30 | Expected Output: 31 | 2 32 | 10 33 | 12 34 | 4 35 | """ 36 | -------------------------------------------------------------------------------- /Python Program to Merge Mails.py: -------------------------------------------------------------------------------- 1 | # Python program to mail merger 2 | # Names are in the file names.txt 3 | # Body of the mail is in body.txt 4 | 5 | # open names.txt for reading 6 | with open("names.txt", 'r', encoding='utf-8') as names_file: 7 | 8 | # open body.txt for reading 9 | with open("body.txt", 'r', encoding='utf-8') as body_file: 10 | 11 | # read entire content of the body 12 | body = body_file.read() 13 | 14 | # iterate over names 15 | for name in names_file: 16 | mail = "Hello " + name.strip() + "\n" + body 17 | 18 | # write the mails to individual files 19 | with open(name.strip()+".txt", 'w', encoding='utf-8') as mail_file: 20 | mail_file.write(mail) 21 | 22 | -------------------------------------------------------------------------------- /ImageDownloader/img_downloader.py: -------------------------------------------------------------------------------- 1 | # ImageDownloader - Muhammed Shokr its amazing 2 | 3 | 4 | def ImageDownloader(url): 5 | import os, re, requests 6 | 7 | response = requests.get(url) 8 | text = response.text 9 | 10 | p = r']+>' 11 | img_addrs = re.findall(p, text) 12 | 13 | for i in img_addrs: 14 | os.system("wget {}".format(i)) 15 | 16 | return "DONE" 17 | 18 | 19 | # USAGE 20 | print("Hey!! Welcome to the Image downloader...") 21 | link=input("Please enter the url from where you want to download the image..") 22 | # now you can give the input at run time and get download the images. 23 | # https://www.123rf.com/stock-photo/spring_color.html?oriSearch=spring&ch=spring&sti=oazo8ueuz074cdpc48 24 | ImageDownloader(link) 25 | -------------------------------------------------------------------------------- /Sorting Algorithms/brickSort.py: -------------------------------------------------------------------------------- 1 | # Python Program to implement 2 | # Odd-Even / Brick Sort 3 | 4 | 5 | def oddEvenSort(arr, n): 6 | # Initially array is unsorted 7 | isSorted = 0 8 | while isSorted == 0: 9 | isSorted = 1 10 | temp = 0 11 | for i in range(1, n - 1, 2): 12 | if arr[i] > arr[i + 1]: 13 | arr[i], arr[i + 1] = arr[i + 1], arr[i] 14 | isSorted = 0 15 | 16 | for i in range(0, n - 1, 2): 17 | if arr[i] > arr[i + 1]: 18 | arr[i], arr[i + 1] = arr[i + 1], arr[i] 19 | isSorted = 0 20 | 21 | return 22 | 23 | 24 | arr = [34, 2, 10, -9] 25 | n = len(arr) 26 | 27 | oddEvenSort(arr, n) 28 | for i in range(0, n): 29 | print(arr[i], end=" ") 30 | -------------------------------------------------------------------------------- /Webbrowser/tk-browser.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # Webbrowser v1.0 3 | # Written by Sina Meysami 4 | # 5 | 6 | from tkinter import * # pip install tk-tools 7 | import tkinterweb # pip install tkinterweb 8 | import sys 9 | 10 | class Browser(Tk): 11 | def __init__(self): 12 | super(Browser,self).__init__() 13 | self.title("Tk Browser") 14 | try: 15 | browser = tkinterweb.HtmlFrame(self) 16 | browser.load_website("https://google.com") 17 | browser.pack(fill="both",expand=True) 18 | except Exception: 19 | sys.exit() 20 | 21 | 22 | def main(): 23 | browser = Browser() 24 | browser.mainloop() 25 | 26 | if __name__ == "__main__": 27 | # Webbrowser v1.0 28 | main() 29 | -------------------------------------------------------------------------------- /binary_search_trees/validate_bst.py: -------------------------------------------------------------------------------- 1 | def is_valid_bst(root,min,max): 2 | """ Function to check if a binary tree is a binary search tree""" 3 | 4 | # If the tree is empty, return True 5 | if root is None: 6 | return True 7 | 8 | # If the root value is less than the minimum value or greater than the maximum value, return False 9 | if min is not None and root.data <= min.data: 10 | return False 11 | 12 | # If the root value is greater than the maximum value or less than the minimum value, return False 13 | elif max is not None and root.data >= max.data: 14 | return False 15 | 16 | # Recursively check if the left and right subtrees are BSTs 17 | return is_valid_bst(root.left,min,root) and is_valid_bst(root.right,root,max) -------------------------------------------------------------------------------- /socket-programming/client.py: -------------------------------------------------------------------------------- 1 | # Note :- Client and Server Must be connected to same Network 2 | # import socket modules 3 | import socket 4 | 5 | # create TCP/IP socket 6 | s = socket.socket() 7 | # take user input ip of server 8 | server = input("Enter Server IP: ") 9 | # bind the socket to the port 12345, and connect 10 | s.connect((server, 12345)) 11 | # receive message from server connection successfully established 12 | data = s.recv(1024).decode("utf-8") 13 | print(server + ": " + data) 14 | 15 | while True: 16 | # send message to server 17 | new_data = str(input("You: ")).encode("utf-8") 18 | s.sendall(new_data) 19 | # receive message from server 20 | data = s.recv(1024).decode("utf-8") 21 | print(server + ": " + data) 22 | 23 | # close connection 24 | s.close() 25 | -------------------------------------------------------------------------------- /binary_search_trees/print_in_range.py: -------------------------------------------------------------------------------- 1 | def print_in_range(root,k1,k2): 2 | 3 | """ This function prints the nodes in a BST that are in the range k1 to k2 inclusive""" 4 | 5 | # If the tree is empty, return 6 | if root is None: 7 | return 8 | 9 | # If the root value is in the range, print the root value 10 | if root.data >= k1 and root.data <= k2: 11 | print_in_range(root.left,k1,k2) 12 | print(root.data) 13 | print_in_range(root.right,k1,k2) 14 | 15 | # If the root value is less than k1, the nodes in the range will be in the right subtree 16 | elif root.data < k1: 17 | print_in_range(root.left,k1,k2) 18 | 19 | # If the root value is greater than k2, the nodes in the range will be in the left subtree 20 | else: 21 | print_in_range(root.right,k1,k2) -------------------------------------------------------------------------------- /sum_of_digits_of_a_number.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | def get_integer_input(prompt, attempts): 4 | for i in range(attempts, 0, -1): 5 | try: 6 | n = int(input(prompt)) 7 | return n 8 | except ValueError: 9 | print("Enter an integer only") 10 | print(f"{i-1} {'chance' if i-1 == 1 else 'chances'} left") 11 | return None 12 | 13 | def sum_of_digits(n): 14 | total = 0 15 | while n > 0: 16 | total += n % 10 17 | n //= 10 18 | return total 19 | 20 | chances = 3 21 | number = get_integer_input("Enter a number: ", chances) 22 | 23 | if number is None: 24 | print("You've used all your chances.") 25 | sys.exit() 26 | 27 | result = sum_of_digits(number) 28 | print(f"The sum of the digits of {number} is: {result}") 29 | -------------------------------------------------------------------------------- /two_num.py: -------------------------------------------------------------------------------- 1 | """Author Anurag Kumar (mailto:anuragkumarak95@gmail.com) 2 | 3 | Given an array of integers, return indices of the two numbers 4 | such that they add up to a specific target. 5 | You may assume that each input would have exactly one solution, 6 | and you may not use the same element twice. 7 | 8 | Example: 9 | Given nums = [2, 7, 11, 15], target = 9, 10 | Because nums[0] + nums[1] = 2 + 7 = 9, 11 | return [0, 1]. 12 | 13 | """ 14 | 15 | 16 | def twoSum(nums, target): 17 | chk_map = {} 18 | for index, val in enumerate(nums): 19 | compl = target - val 20 | if compl in chk_map: 21 | indices = [chk_map[compl], index] 22 | print(indices) 23 | return [indices] 24 | else: 25 | chk_map[val] = index 26 | return False 27 | -------------------------------------------------------------------------------- /Sorting Algorithms/pigeonhole_sort.py: -------------------------------------------------------------------------------- 1 | # know what is Pigeonhole_principle 2 | # https://www.youtube.com/watch?v=IeTLZPNIPJQ 3 | 4 | 5 | def pigeonhole_sort(a): 6 | 7 | # (number of pigeonholes we need) 8 | my_min = min(a) 9 | my_max = max(a) 10 | size = my_max - my_min + 1 11 | 12 | # total pigeonholes 13 | holes = [0] * size 14 | 15 | # filling up the pigeonholes. 16 | for x in a: 17 | holes[x - my_min] += 1 18 | 19 | # Put the elements back into the array in order. 20 | i = 0 21 | for count in range(size): 22 | while holes[count] > 0: 23 | holes[count] -= 1 24 | a[i] = count + my_min 25 | i += 1 26 | 27 | 28 | a = [10, 3, 2, 7, 4, 6, 8] 29 | 30 | # list only integers 31 | print(pigeonhole_sort(a)) 32 | print(a) 33 | -------------------------------------------------------------------------------- /Sorting Algorithms/selection_sort.py: -------------------------------------------------------------------------------- 1 | def selection_sort(nums): 2 | # This value of i corresponds to how many values were sorted 3 | for i in range(len(nums)): 4 | # We assume that the first item of the unsorted segment is the smallest 5 | lowest_value_index = i 6 | # This loop iterates over the unsorted items 7 | for j in range(i + 1, len(nums)): 8 | if nums[j] < nums[lowest_value_index]: 9 | lowest_value_index = j 10 | # Swap values of the lowest unsorted element with the first unsorted 11 | # element 12 | nums[i], nums[lowest_value_index] = nums[lowest_value_index], nums[i] 13 | 14 | 15 | # Verify it works 16 | random_list_of_nums = [12, 8, 3, 20, 11] 17 | selection_sort(random_list_of_nums) 18 | print(random_list_of_nums) 19 | -------------------------------------------------------------------------------- /nitkarshchourasia/to_sort/django_projects/ToDo_webapp/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | """Run administrative tasks.""" 9 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "todo_site.settings") 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == "__main__": 22 | main() 23 | -------------------------------------------------------------------------------- /email id dictionary/dict1.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | counts = dict() 4 | mails = list() 5 | fname = input("Enter file name:") 6 | fh = open(fname) 7 | for line in fh: 8 | if not line.startswith("From "): 9 | continue 10 | # if line.startswith('From:'): 11 | # continue 12 | id = line.split() 13 | mail = id[1] 14 | mails.append(mail) 15 | 16 | freq_mail = max(mails, key=mails.count) # To find frequent mail 17 | print(freq_mail, mails.count(freq_mail)) # To find countof frequent mail 18 | 19 | 20 | """ 21 | for x in mails: 22 | counts[x]=counts.get(x,0)+1 23 | bigmail=None 24 | bigvalue=None 25 | for key,value in counts.items(): 26 | if bigvalue==None or bigvalue= start: 4 | mid = start + (end- start)//2 5 | # If element is present at the middle 6 | if arr[mid] == x: 7 | return mid 8 | # If element is smaller than mid 9 | elif arr[mid] > x: 10 | return binarySearchAppr(arr, start, mid-1, x) 11 | # Else the element greator than mid 12 | else: 13 | return binarySearchAppr(arr, mid+1, end, x) 14 | else: 15 | # Element is not found in the array 16 | return -1 17 | arr = sorted(['t','u','t','o','r','i','a','l']) 18 | x ='r' 19 | result = binarySearchAppr(arr, 0, len(arr)-1, x) 20 | if result != -1: 21 | print ("Element is present at index "+str(result)) 22 | else: 23 | print ("Element is not present in array") 24 | -------------------------------------------------------------------------------- /1 File handle/File handle binary/Update a binary file.py: -------------------------------------------------------------------------------- 1 | # Updating records in a binary file 2 | 3 | import pickle 4 | 5 | 6 | def update(): 7 | with open("class.dat", "rb+") as F: 8 | S = pickle.load(F) 9 | found = False 10 | rno = int(input("enter the roll number you want to update")) 11 | 12 | for i in S: 13 | if rno == i[0]: 14 | print(f"the currrent name is {i[1]}") 15 | i[1] = input("enter the new name") 16 | found = True 17 | break 18 | 19 | if found: 20 | print("Record not found") 21 | 22 | else: 23 | F.seek(0) 24 | pickle.dump(S, F) 25 | 26 | 27 | update() 28 | 29 | with open("class.dat", "rb") as F: 30 | print(pickle.load(F)) 31 | -------------------------------------------------------------------------------- /Sorting Algorithms/selectionSort.py: -------------------------------------------------------------------------------- 1 | list = [] 2 | 3 | N = int(input("Enter The Size Of List")) 4 | 5 | for i in range(0, N): 6 | a = int(input("Enter The number")) 7 | list.append(a) 8 | 9 | 10 | # Let's sort list in ascending order using Selection Sort 11 | # Every time The Element Of List is fetched and the smallest element in remaining list is found and if it comes out 12 | # to be smaller than the element fetched then it is swapped with smallest number. 13 | 14 | for i in range(0, len(list) - 1): 15 | smallest = list[i + 1] 16 | k = 0 17 | for j in range(i + 1, len(list)): 18 | if list[j] <= smallest: 19 | smallest = list[j] 20 | k = j 21 | 22 | if smallest < list[i]: 23 | temp = list[i] 24 | list[i] = list[k] 25 | list[k] = temp 26 | 27 | print(list) 28 | -------------------------------------------------------------------------------- /Weather Scrapper/weather.csv: -------------------------------------------------------------------------------- 1 | City,Time,Date,Temperature,Precipitation,Sky,Wind 2 | Manhatten,07:02,Tue 06/05,Low 71 F,Precipitate:30%,Isolated Thunderstorms,Winds light and variable 3 | Manhattan,07:03,Wed 06/06,Low 47 F,Precipitate:10%,Partly Cloudy,Winds NE at 10 to 15 mph 4 | Aligarh,07:03,Wed 06/06,High 109 F,Precipitate:20%,Partly Cloudy,Winds ENE at 10 to 15 mph 5 | Delhi,07:03,Wed 06/06,High 107 F,Precipitate:40%,AM Thunderstorms,Winds E at 10 to 15 mph 6 | Portland,02:20,Aug-21-2022,Low 61F,Precipitation:3%,A few clouds,Winds light and variable. 7 | Washington,02:21,Aug-21-2022,High 83F,Precipitation:48%,Cloudy early with scattered thunderstorms developing this afternoon,Winds SSE at 5 to 10 mph 8 | Guadalajara,02:21,Aug-21-2022,Scattered thunderstorms developing this afternoon,Precipitation:52%,Mostly cloudy this morning,High near 80F 9 | -------------------------------------------------------------------------------- /ex20.py: -------------------------------------------------------------------------------- 1 | from sys import argv 2 | 3 | script, input_file = argv 4 | 5 | 6 | def print_all(f): 7 | print(f.read()) 8 | 9 | 10 | # seek(n) to read a file's content from byte-n 11 | def rewind(f): 12 | f.seek(0) 13 | 14 | 15 | def print_a_line(line_count, f): 16 | print(line_count, f.readline()) 17 | 18 | 19 | current_file = open(input_file) 20 | 21 | print("First let's print the whole file:\n") 22 | print_all(current_file) 23 | 24 | print("Now let's rewind, kind of like a tape.") 25 | rewind(current_file) 26 | 27 | print("Let's print three lines:") 28 | current_line = 1 29 | print_a_line(current_line, current_file) 30 | 31 | current_line = current_line + 1 32 | print_a_line(current_line, current_file) 33 | 34 | current_line = current_line + 1 35 | print_a_line(current_line, current_file) 36 | 37 | current_file.close() 38 | -------------------------------------------------------------------------------- /num-py.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | # to check if shape are equal and find there power 4 | def get_array(x, y): 5 | a = np.shape(x) 6 | b = np.shape(y) 7 | 8 | if a == b: 9 | np_pow_array = x ** y 10 | print("Array of powers without using np.power: ", np_pow_array) 11 | 12 | print("Array of powers using np.power: ", np.power(x, y)) 13 | else: 14 | print("Error : Shape of the given arrays is not equal.") 15 | 16 | 17 | # 0d array 18 | np_arr1 = np.array(3) 19 | np_arr2 = np.array(4) 20 | # 1d array 21 | np_arr3 = np.array([1, 2]) 22 | np_arr4 = np.array([3, 4]) 23 | # 2d array 24 | np_arr5 = np.array([[1, 2], [3, 4]]) 25 | np_arr6 = np.array([[5, 6], [7, 8]]) 26 | 27 | get_array(np_arr1, np_arr2) 28 | print() 29 | get_array(np_arr3, np_arr4) 30 | print() 31 | get_array(np_arr5, np_arr6) 32 | -------------------------------------------------------------------------------- /slack_message.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | 3 | # Created by sarathkaul on 11/11/19 4 | 5 | import json 6 | import urllib.request 7 | 8 | # Set the webhook_url to the one provided by Slack when you create the webhook at https://my.slack.com/services/new/incoming-webhook/ 9 | webhook_url = ( 10 | "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX" 11 | ) 12 | slack_data = {"text": "Hi Sarath Kaul"} 13 | 14 | response = urllib.request.Request( 15 | webhook_url, 16 | data=json.dumps(slack_data), 17 | headers={"Content-Type": "application/json"}, 18 | ) 19 | print(response) 20 | # if response.status_code != 200: 21 | # raise ValueError( 22 | # 'Request to slack returned an error %s, the response is:\n%s' 23 | # % (response.status_code, response.text) 24 | # ) 25 | -------------------------------------------------------------------------------- /Battery_notifier.py: -------------------------------------------------------------------------------- 1 | from plyer import notification # pip install plyer 2 | import psutil # pip install psutil 3 | 4 | # psutil.sensors_battery() will return the information related to battery 5 | battery = psutil.sensors_battery() 6 | 7 | # battery percent will return the current battery prcentage 8 | percent = battery.percent 9 | charging = ( 10 | battery.power_plugged 11 | ) 12 | 13 | # Notification(title, description, duration)--to send 14 | # notification to desktop 15 | # help(Notification) 16 | if charging: 17 | if percent == 100: 18 | charging_message = "Unplug your Charger" 19 | else: 20 | charging_message = "Charging" 21 | else: 22 | charging_message = "Not Charging" 23 | message = str(percent) + "% Charged\n" + charging_message 24 | 25 | notification.notify("Battery Information", message, timeout=10) 26 | -------------------------------------------------------------------------------- /insta_monitering/subpinsta.py: -------------------------------------------------------------------------------- 1 | # trggering the process 2 | import os 3 | import subprocess 4 | import sys 5 | 6 | 7 | def instasubprocess(user, tags, type, productId): 8 | try: 9 | child_env = sys.executable 10 | file_pocessing = ( 11 | os.getcwd() 12 | + "/insta_datafetcher.py " 13 | + user 14 | + " " 15 | + tags 16 | + " " 17 | + type 18 | + " " 19 | + productId 20 | ) 21 | command = child_env + " " + file_pocessing 22 | result = subprocess.Popen(command, shell=True) 23 | result.wait() 24 | except: 25 | print("error::instasubprocess>>", sys.exc_info()[1]) 26 | 27 | 28 | if __name__ == "__main__": 29 | instasubprocess(user="u2", tags="food", type="hashtags", productId="abc") 30 | -------------------------------------------------------------------------------- /ReadFromCSV.py: -------------------------------------------------------------------------------- 1 | __author__ = "vamsi" 2 | import pandas as pd # pandas library to read csv file 3 | from matplotlib import pyplot as plt # matplotlib library to visualise the data 4 | from matplotlib import style 5 | 6 | style.use("ggplot") 7 | 8 | """reading data from SalesData.csv file 9 | and passing data to dataframe""" 10 | 11 | df = pd.read_csv("..\SalesData.csv") # Reading the csv file 12 | x = df[ 13 | "SalesID" 14 | ].as_matrix() # casting SalesID to list #extracting the column with name SalesID 15 | y = df["ProductPrice"].as_matrix() # casting ProductPrice to list 16 | plt.xlabel("SalesID") # assigning X-axis label 17 | plt.ylabel("ProductPrice") # assigning Y-axis label 18 | plt.title("Sales Analysis") # assigning Title to the graph 19 | plt.plot(x, y) # Plot X and Y axis 20 | plt.show() # Show the graph 21 | -------------------------------------------------------------------------------- /add_two_nums.py: -------------------------------------------------------------------------------- 1 | __author__ = "Nitkarsh Chourasia" 2 | __version__ = "1.0" 3 | def addition( 4 | num1: typing.Union[int, float], 5 | num2: typing.Union[int, float] 6 | ) -> str: 7 | """A function to add two given numbers.""" 8 | 9 | # Checking if the given parameters are numerical or not. 10 | if not isinstance(num1, (int, float)): 11 | return "Please input numerical values only for num1." 12 | if not isinstance(num2, (int, float)): 13 | return "Please input numerical values only for num2." 14 | 15 | # Adding the given parameters. 16 | sum_result = num1 + num2 17 | 18 | # returning the result. 19 | return f"The sum of {num1} and {num2} is: {sum_result}" 20 | ) 21 | 22 | print(addition(5, 10)) # This will use the provided parameters 23 | print(addition(2, 2)) 24 | print(addition(-3, -5)) 25 | -------------------------------------------------------------------------------- /JARVIS/README.md: -------------------------------------------------------------------------------- 1 | # JARVIS 2 | patch-5
3 | It can Control windows programs with your voice.
4 | What can it do: 5 | 1. It can tell you time.
6 | 2. It can open, These of the following:-
a.) Notepad
7 | b.) Calculator
8 | c.) Sticky Note
9 | d.) PowerShell
10 | e.) MS Paint
11 | f.) cmd
12 | g.) Browser (Internet Explorer)
13 | 14 | It will make your experience better while using the Windows computer. 15 | =========================================================================== 16 | It demonstrates Controlling windows programs with your voice. 17 | -------------------------------------------------------------------------------- /colorma_as_color.py: -------------------------------------------------------------------------------- 1 | import colorama as color 2 | 3 | 4 | from colorama import Fore, Back, Style 5 | 6 | print(Fore.RED + "some red text") 7 | print(Back.GREEN + "and with a green background") 8 | print("So any text will be in green background?") 9 | 10 | print("So is it a wrapper of some sort?") 11 | print("dark_angel wasn't using it in her code.") 12 | print("she was just being using direct ANSI codes.") 13 | print(Style.RESET_ALL) 14 | print(Fore.BRIGHT_RED + "some bright red text") 15 | print(Back.WHITE + "and with a white background") 16 | print("Will need to study about what is ANSI codes.") 17 | print(Style.DIM + "and in dim text") 18 | print(Style.RESET_ALL) 19 | print("back to normal now") 20 | 21 | 22 | # …or, Colorama can be used in conjunction with existing ANSI libraries such as the venerable Termcolor the fabulous Blessings, or the incredible _Rich. -------------------------------------------------------------------------------- /cricket_news.py: -------------------------------------------------------------------------------- 1 | from bs4 import BeautifulSoup 2 | import requests 3 | import pyttsx3 4 | 5 | engine = pyttsx3.init() 6 | voices = engine.getProperty("voices") 7 | engine.setProperty("voice", voices[0].id) 8 | 9 | 10 | def speak(audio): 11 | engine.say(audio) 12 | engine.runAndWait() 13 | 14 | 15 | url = "https://www.cricbuzz.com/cricket-news/latest-news" 16 | 17 | ans = requests.get(url) 18 | 19 | soup = BeautifulSoup(ans.content, "html.parser") 20 | 21 | anchors = soup.find_all("a", class_="cb-nws-hdln-ancr text-hvr-underline") 22 | i = 1 23 | speak("Welcome to sports news headlines!") 24 | for anchor in anchors: 25 | speak(anchor.get_text()) 26 | i += 1 27 | if i == 11: 28 | break 29 | speak("Moving on next sports headline..") 30 | speak("These all are major headlines, have a nice day SIR") 31 | -------------------------------------------------------------------------------- /multiplication_table.py: -------------------------------------------------------------------------------- 1 | """ 2 | The 'multiplication table' Implemented in Python 3 3 | 4 | Syntax: 5 | python3 multiplication_table.py [rows columns] 6 | Separate filenames with spaces as usual. 7 | 8 | Updated by Borys Baczewski (BB_arbuz on GitHub) - 06/03/2022 9 | """ 10 | 11 | from sys import argv # import argument variable 12 | 13 | ( 14 | script, 15 | rows, 16 | columns, 17 | ) = argv # define rows and columns for the table and assign them to the argument variable 18 | 19 | 20 | def table(rows, columns): 21 | columns = int(columns) 22 | rows = int(rows) 23 | for r in range(1, rows+1): 24 | c = r 25 | print(r, end='\t') 26 | i = 0 27 | while columns-1 > i: 28 | print(c+r, end='\t') 29 | c = c+r 30 | i += 1 31 | print('\n') 32 | 33 | 34 | table(rows, columns) 35 | -------------------------------------------------------------------------------- /check_internet_con.py: -------------------------------------------------------------------------------- 1 | from sys import argv 2 | 3 | try: 4 | # For Python 3.0 and later 5 | from urllib.error import URLError 6 | from urllib.request import urlopen 7 | except ImportError: 8 | # Fall back to Python 2's urllib2 9 | from urllib2 import URLError, urlopen 10 | 11 | 12 | def checkInternetConnectivity(): 13 | try: 14 | url = argv[1] 15 | print(url) 16 | protocols = ["https://", "http://"] 17 | if not any(x for x in protocols if x in url): 18 | url = "https://" + url 19 | print("URL:" + url) 20 | except BaseException: 21 | url = "https://google.com" 22 | try: 23 | urlopen(url, timeout=2) 24 | print(f'Connection to "{url}" is working') 25 | 26 | except URLError as E: 27 | print("Connection error:%s" % E.reason) 28 | 29 | 30 | checkInternetConnectivity() 31 | -------------------------------------------------------------------------------- /Downloaded Files Organizer/readme.md: -------------------------------------------------------------------------------- 1 | # Downloaded files organizer using python 2 | ##### Operating System : Windows Only 3 | ### Modules used 4 | 1.Built-in Modules: 5 | sys,os,time 6 | 2.External Modules: 7 | download the following modules using pip: 8 | psutil,watchdog 9 | ### How to use 10 | 1.After installing above modules,run browser_status.py.In browser_status.py makesure correct download path is given in this script. 11 | 2.Make sure that all the three python scripts reside in same directory 12 | 13 | ### Working 14 | Whenever a file is downloaded,when this script is running ,it automatically categorize the file based on the file extension 15 | For example, if a python script is downloaded which has ".py" extension, it goes into "code" folder automatically. 16 | 17 | The file extensions and categories are collected from 18 | https://github.com/dyne/file-extension-list 19 | -------------------------------------------------------------------------------- /nitkarshchourasia/to_sort/JARVIS_python_bot/README.md: -------------------------------------------------------------------------------- 1 | # JARVIS 2 | patch-5
3 | It can Control windows programs with your voice.
4 | What can it do: 5 | 1. It can tell you time.
6 | 2. It can open, These of the following:-
a.) Notepad
7 | b.) Calculator
8 | c.) Sticky Note
9 | d.) PowerShell
10 | e.) MS Paint
11 | f.) cmd
12 | g.) Browser (Internet Explorer)
13 | 14 | It will make your experience better while using the Windows computer. 15 | =========================================================================== 16 | It demonstrates Controlling windows programs with your voice. 17 | -------------------------------------------------------------------------------- /Downloaded Files Organizer/obs.py: -------------------------------------------------------------------------------- 1 | def watcher(path): 2 | # python script to observe changes in a folder 3 | import sys 4 | import time 5 | import os 6 | from watchdog.observers import Observer 7 | from watchdog.events import FileSystemEventHandler 8 | from move_to_directory import add_to_dir 9 | 10 | class Handler(FileSystemEventHandler): 11 | def on_created(self, event): 12 | if event.event_type == "created": 13 | file_name = os.path.basename(event.src_path) 14 | ext = os.path.splitext(event.src_path)[1] 15 | time.sleep(2) 16 | add_to_dir(ext[1:], event.src_path, path) 17 | observer.stop() 18 | 19 | observer = Observer() 20 | event_handler = Handler() 21 | observer.schedule(event_handler, path, recursive=True) 22 | observer.start() 23 | observer.join() 24 | -------------------------------------------------------------------------------- /Sorting Algorithms/stooge_sort.py: -------------------------------------------------------------------------------- 1 | # See what stooge sort dooes 2 | # https://www.youtube.com/watch?v=vIDkfrSdID8 3 | 4 | 5 | def stooge_sort_(arr, l, h): 6 | if l >= h: 7 | return 0 8 | 9 | # If first element is smaller than last, then swap 10 | 11 | if arr[l] > arr[h]: 12 | t = arr[l] 13 | arr[l] = arr[h] 14 | arr[h] = t 15 | 16 | # If there are more than 2 elements in array 17 | if h - l + 1 > 2: 18 | t = (int)((h - l + 1) / 3) 19 | 20 | # Recursively sort first 2 / 3 elements 21 | stooge_sort_(arr, l, (h - t)) 22 | 23 | # Recursively sort last 2 / 3 elements 24 | stooge_sort_(arr, l + t, (h)) 25 | 26 | # Recursively sort first 2 / 3 elements 27 | stooge_sort_(arr, l, (h - t)) 28 | 29 | 30 | arr = [2, 4, 5, 3, 1] 31 | n = len(arr) 32 | 33 | stooge_sort_(arr, 0, n - 1) 34 | 35 | print(arr) 36 | -------------------------------------------------------------------------------- /numberguessinggame/index.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | def number_guessing_game(): 4 | 5 | secret_number = random.randint(1, 100) 6 | attempts = 0 7 | 8 | print("Welcome to the Number Guessing Game!") 9 | print("I'm thinking of a number between 1 and 100.") 10 | 11 | while True: 12 | try: 13 | guess = int(input("Your guess: ")) 14 | attempts += 1 15 | 16 | if guess < secret_number: 17 | print("Too low! Try again.") 18 | elif guess > secret_number: 19 | print("Too high! Try again.") 20 | else: 21 | print(f"Congratulations! You guessed the number {secret_number} in {attempts} attempts!") 22 | break 23 | 24 | except ValueError: 25 | print("Please enter a valid number.") 26 | 27 | if __name__ == "__main__": 28 | number_guessing_game() 29 | -------------------------------------------------------------------------------- /spiralmatrix.py: -------------------------------------------------------------------------------- 1 | n = int(input("Enter the size of matrix:")) 2 | t = 1 3 | r = 0 # r stands for row 4 | c = 0 # c stands for column 5 | matrix = [[0 for x in range(n)] for y in range(n)] # to initialise the matrix 6 | if n % 2 == 0: 7 | k = n // 2 8 | else: 9 | k = int((n / 2) + 1) 10 | for i in range(k): 11 | while c < n: 12 | matrix[r][c] = t 13 | t = t + 1 14 | c = c + 1 15 | r = r + 1 16 | c = c - 1 17 | while r < n: 18 | matrix[r][c] = t 19 | t = t + 1 20 | r = r + 1 21 | r = r - 1 22 | c = c - 1 23 | while c >= i: 24 | matrix[r][c] = t 25 | c = c - 1 26 | t = t + 1 27 | c = c + 1 28 | r = r - 1 29 | while r > i: 30 | matrix[r][c] = t 31 | t = t + 1 32 | r = r - 1 33 | r = r + 1 34 | n = n - 1 35 | c = c + 1 36 | for m in matrix: 37 | print(m) 38 | -------------------------------------------------------------------------------- /convert_time.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | 3 | # Created by sarathkaul on 12/11/19 4 | 5 | 6 | def convert_time(input_str): 7 | # Checking if last two elements of time 8 | # is AM and first two elements are 12 9 | if input_str[-2:] == "AM" and input_str[:2] == "12": 10 | return "00" + input_str[2:-2] 11 | 12 | # remove the AM 13 | elif input_str[-2:] == "AM": 14 | return input_str[:-2] 15 | 16 | # Checking if last two elements of time 17 | # is PM and first two elements are 12 18 | elif input_str[-2:] == "PM" and input_str[:2] == "12": 19 | return input_str[:-2] 20 | 21 | else: 22 | # add 12 to hours and remove PM 23 | return str(int(input_str[:2]) + 12) + input_str[2:8] 24 | 25 | 26 | if __name__ == "__main__": 27 | input_time = input("Enter time you want to convert: ") 28 | print(convert_time(input_time)) 29 | -------------------------------------------------------------------------------- /CountMillionCharacters-Variations/variation1.py: -------------------------------------------------------------------------------- 1 | try: 2 | input = raw_input 3 | except NameError: 4 | pass 5 | 6 | 7 | def count_chars(filename): 8 | count = {} 9 | 10 | with open(filename) as info: # inputFile Replaced with filename 11 | readfile = info.read() 12 | for character in readfile.upper(): 13 | count[character] = count.get(character, 0) + 1 14 | 15 | return count 16 | 17 | 18 | def main(): 19 | is_exist = True 20 | # Try to open file if exist else raise exception and try again 21 | while is_exist: 22 | try: 23 | inputFile = input("File Name / (0)exit : ").strip() 24 | if inputFile == "0": 25 | break 26 | print(count_chars(inputFile)) 27 | except FileNotFoundError: 28 | print("File not found...Try again!") 29 | 30 | 31 | if __name__ == "__main__": 32 | main() 33 | -------------------------------------------------------------------------------- /XML/HTML parsing: -------------------------------------------------------------------------------- 1 | dinner_recipe = ''' 2 | 3 | 4 | 5 | 6 | 7 |
amtunititem
24slicesbaguette
2+tbspolive oil
1cuptomatoes
1jarpesto
''' 8 | 9 | # From http://effbot.org/zone/element-index.htm 10 | import xml.etree.ElementTree as etree 11 | tree = etree.fromstring(dinner_recipe) 12 | 13 | # For invalid HTML use http://effbot.org/zone/element-soup.htm 14 | # import ElementSoup, StringIO 15 | # tree = ElementSoup.parse(StringIO.StringIO(dinner_recipe)) 16 | 17 | pantry = set(['olive oil', 'pesto']) 18 | for ingredient in tree.getiterator('tr'): 19 | amt, unit, item = ingredient 20 | if item.tag == "td" and item.text not in pantry: 21 | print ("%s: %s %s" % (item.text, amt.text, unit.text)) 22 | -------------------------------------------------------------------------------- /1 File handle/File handle binary/Update a binary file2.py: -------------------------------------------------------------------------------- 1 | # updating records in a binary file 2 | 3 | import pickle 4 | 5 | 6 | def update(): 7 | 8 | with open("studrec.dat", "rb+") as File: 9 | value = pickle.load(File) 10 | found = False 11 | roll = int(input("Enter the roll number of the record")) 12 | 13 | for i in value: 14 | if roll == i[0]: 15 | print(f"current name {i[1]}") 16 | print(f"current marks {i[2]}") 17 | i[1] = input("Enter the new name") 18 | i[2] = int(input("Enter the new marks")) 19 | found = True 20 | 21 | if not found: 22 | print("Record not found") 23 | 24 | else: 25 | pickle.dump(value, File) 26 | File.seek(0) 27 | print(pickle.load(File)) 28 | 29 | 30 | update() 31 | -------------------------------------------------------------------------------- /Windows_Wallpaper_Script/ReadMe.md: -------------------------------------------------------------------------------- 1 | # Windows Wallpaper Script 2 | Ever seen those amazing windows wallpapers on your windows lock screen? This Python Script will Import all of those amazing wallpapers into the current folder that the script is in. 3 | The wallpapers keep changing with time when connected to the internet so you can run the script after you notice new wallpapers on your lockscreen in order to obtain them. 4 | 5 | ***Optional:*** You can also use the windows task scheduler and schedule 6 | the script to run in a set time interval and also set the desktop wallpaper folder as default wallpaper folder. For more Info on task scheduling in Windows 10, 7 | Look Here: [Task Scheduling in windows](https://www.digitalcitizen.life/how-create-task-basic-task-wizard) 8 | 9 | # Requirements 10 | * A Windows 10 PC 11 | * Python 3x 12 | * PIL Module For Python 3x 13 | 14 | # Procedure 15 | * Run the script and enjoy! 16 | -------------------------------------------------------------------------------- /find_cube_root.py: -------------------------------------------------------------------------------- 1 | # This method is called exhaustive numeration! 2 | # I am checking every possible value 3 | # that can be root of given x systematically 4 | # Kinda brute forcing 5 | 6 | 7 | def cubeRoot(): 8 | x = int(input("Enter an integer: ")) 9 | for ans in range(0, abs(x) + 1): 10 | if ans ** 3 == abs(x): 11 | break 12 | if ans ** 3 != abs(x): 13 | print(x, "is not a perfect cube!") 14 | else: 15 | if x < 0: 16 | ans = -ans 17 | print("Cube root of " + str(x) + " is " + str(ans)) 18 | 19 | 20 | cubeRoot() 21 | 22 | cont = input("Would you like to continue: ") 23 | while cont == "yes" or "y": 24 | cubeRoot() 25 | cont = input("Would you like to continue: ") 26 | if cont == "no" or "n": 27 | exit() 28 | else: 29 | print("Enter a correct answer(yes or no)") 30 | cont = input("Would you like to continue: ") 31 | -------------------------------------------------------------------------------- /internet_connection_py3.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | 3 | import os 4 | import urllib.request 5 | 6 | from selenium import webdriver 7 | 8 | print("Testing Internet Connection") 9 | print() 10 | try: 11 | urllib.request.urlopen( 12 | "http://google.com", timeout=2 13 | ) # Tests if connection is up and running 14 | print("Internet is working fine!") 15 | print() 16 | question = input("Do you want to open a website? (Y/N): ") 17 | if question == "Y": 18 | print() 19 | search = input("Input website to open (http://website.com) : ") 20 | else: 21 | os._exit(0) 22 | 23 | except urllib.error.URLError: 24 | print("No internet connection!") # Output if no connection 25 | 26 | browser = webdriver.Firefox() 27 | browser.get(search) 28 | os.system("cls") # os.system('clear') if Linux 29 | print("[+] Website " + search + " opened!") 30 | browser.close() 31 | -------------------------------------------------------------------------------- /remove a character from a file and rewrite.py: -------------------------------------------------------------------------------- 1 | #Remove all the lines that contain the character `a' in a file and write it to another file. 2 | f=open("test1.txt","r") #opening file test1.txt 3 | lines = f.readlines() #saved lines 4 | print("Original file is :") 5 | print(lines) 6 | f.close() 7 | 8 | # Rewriting lines 9 | 10 | e=open("test3.txt","w") # file containing lines with 'a' 11 | f=open("test1.txt","w") # file containing lines without 'a' 12 | for line in lines: 13 | if 'a' in line or 'A' in line: 14 | e.write(line) 15 | else: 16 | f.write(line) 17 | 18 | e.close() 19 | f.close() 20 | 21 | f=open("test1.txt","r") 22 | lines=f.readlines() 23 | 24 | e=open("test3.txt","r") 25 | lines1=e.readlines() 26 | 27 | print("\n") 28 | 29 | print("Files without letter a:") 30 | print(lines) 31 | print("\n") 32 | 33 | print("Files with letter a:") 34 | print(lines1) 35 | 36 | e.close() 37 | f.close() 38 | -------------------------------------------------------------------------------- /thread_signal.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | 3 | import signal 4 | import threading 5 | from time import sleep 6 | 7 | 8 | class producer(threading.Thread): 9 | def __init__(self, event): 10 | threading.Thread.__init__(self) 11 | self.event = event 12 | 13 | def run(self): 14 | while self.event.is_set(): 15 | print("sub thread") 16 | sleep(2) 17 | else: 18 | print("sub thread end") 19 | exit() 20 | 21 | 22 | def handler_thread(event): 23 | print("main thread end") 24 | event.clear() 25 | 26 | 27 | def handler(signum, frame): 28 | handler_thread(frame.f_globals["event"]) 29 | 30 | 31 | signal.signal(signal.SIGINT, handler) 32 | 33 | print("main thread") 34 | event = threading.Event() 35 | event.set() 36 | p = producer(event) 37 | p.start() 38 | p.join() 39 | 40 | sleep(100) # 一定要使主线程处于活动状态,否则信号处理对子线程不起作用 41 | -------------------------------------------------------------------------------- /Sorting Algorithms/Binary_Insertion_Sort.py: -------------------------------------------------------------------------------- 1 | def Binary_Search(Test_arr, low, high, k): 2 | if high >= low: 3 | Mid = (low + high) // 2 4 | if Test_arr[Mid] < k: 5 | return Binary_Search(Test_arr, Mid + 1, high, k) 6 | elif Test_arr[Mid] > k: 7 | return Binary_Search(Test_arr, low, Mid - 1, k) 8 | else: 9 | return Mid 10 | else: 11 | return low 12 | 13 | 14 | def Insertion_Sort(Test_arr): 15 | for i in range(1, len(Test_arr)): 16 | val = Test_arr[i] 17 | j = Binary_Search(Test_arr[:i], 0, len(Test_arr[:i]) - 1, val) 18 | Test_arr.pop(i) 19 | Test_arr.insert(j, val) 20 | return Test_arr 21 | 22 | 23 | if __name__ == "__main__": 24 | Test_list = input("Enter the list of Numbers: ").split() 25 | Test_list = [int(i) for i in Test_list] 26 | print(f"Binary Insertion Sort: {Insertion_Sort(Test_list)}") 27 | --------------------------------------------------------------------------------