From e0e22d07d74329f00e60f66c2fddd4a254942811 Mon Sep 17 00:00:00 2001 From: Nitkarsh Chourasia Date: Sun, 23 Jul 2023 05:14:04 +0530 Subject: [PATCH 1/4] Adding snake_case_renamer_depth_one.py --- snake_case_renamer_depth_one.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 snake_case_renamer_depth_one.py diff --git a/snake_case_renamer_depth_one.py b/snake_case_renamer_depth_one.py new file mode 100644 index 00000000000..089e75ff2dd --- /dev/null +++ b/snake_case_renamer_depth_one.py @@ -0,0 +1,23 @@ +import os + +repository_path = r"D:\coding\Python-Programs" + +def rename_files_and_folders(directory): + for name in os.listdir(directory): + old_path = os.path.join(directory, name) + new_name = name.lower().replace(" ", "_") + new_path = os.path.join(directory, new_name) + + # Check if the new filename is different from the old filename + if new_name != name: + # Check if the new filename already exists in the directory + if os.path.exists(new_path): + # If the new filename exists, add a number at the end to make it unique + index = 1 + while os.path.exists(f"{os.path.splitext(new_path)[0]}_{index}{os.path.splitext(new_path)[1]}"): + index += 1 + new_path = f"{os.path.splitext(new_path)[0]}_{index}{os.path.splitext(new_path)[1]}" + + os.rename(old_path, new_path) + +rename_files_and_folders(repository_path) From 85e05d853091963f84854e6e92ebd5d4f3111fed Mon Sep 17 00:00:00 2001 From: Nitkarsh Chourasia Date: Sun, 23 Jul 2023 05:16:07 +0530 Subject: [PATCH 2/4] Renaming depth 1 using standard practices. --- .../Deleting record in a binary file.py | 42 +- ...e binary read (record in non list form).py | 46 +- .../Update a binary file.py | 66 +- .../Update a binary file2.py | 62 +- .../File handle binary/class.dat | Bin ...on 1 (elegible for remedial, top marks).py | 154 ++--- .../search record in binary file.py | 48 +- .../File handle binary/studrec.dat | Bin ...e handle 12 length of line in text file.py | 74 +-- .../File handle text/happy.txt | 20 +- .../input,output and error streams.py | 32 +- .../File handle text/question 2.py | 74 +-- .../File handle text/question 5.py | 104 +-- .../File handle text/question 6.py | 40 +- .../File handle text/question3.py | 96 +-- .../special symbol after word.py | 32 +- .../File handle text/story.txt | 8 +- ...> a_solution_to_project_euler_problem_3.py | 0 add 2 number.py => add_2_number.py | 0 add 2 numbers.py => add_2_numbers.py | 0 ...Linked_List.py => add_two_linked_list_1.py | 136 ++-- add two no.py => add_two_no.py | 0 add two number.py => add_two_number.py | 0 Add two numbers.py => add_two_numbers.py | 0 ...wo numbers.py => addtion_of_two_numbers.py | 0 AREA OF TRIANGLE.py => area_of_triangle.py | 0 AreaOfTriangle.py => areaoftriangle_1.py | 0 ARKA.py => arka_1.py | 0 Armstrong_number => armstrong_number_1 | 0 Armstrong_number.py => armstrong_number_1.py | 42 +- ...uecharacter.py => asciivaluecharacter_1.py | 0 {Assembler => assembler_1}/GUIDE.txt | 0 {Assembler => assembler_1}/README.md | 0 {Assembler => assembler_1}/assembler.py | 0 {Assembler => assembler_1}/examples/code.txt | 0 {Assembler => assembler_1}/examples/code2.txt | 0 {Assembler => assembler_1}/examples/code3.txt | 0 {Assembler => assembler_1}/examples/code4.txt | 0 {Assembler => assembler_1}/examples/test.txt | 0 {Assembler => assembler_1}/requirements.txt | 0 .../caller.py | 0 .../requirements.txt | 0 .../schedular.py | 0 ...lication .ipynb => bank_application_.ipynb | 0 ...stem.py => base_converter_number_system.py | 0 basic example => basic_example | 0 Battery_notifier.py => battery_notifier_1.py | 0 ... Coefficients.py => binary_coefficients.py | 0 binary search.py => binary_search_1.py | 0 Binary_search.py => binary_search_2.py | 0 ...ry_to_Decimal.py => binary_to_decimal_1.py | 0 ....Java => binarystree_istrue_yashv1729.java | 0 .../blackjack.py | 0 .../blackjack_rr.py | 0 .../blackjack_simulate.py | 0 .../requirements.txt | 0 blackJackGUI.py => blackjackgui_1.py | 362 +++++------ {BoardGame-CLI => boardgame-cli_1}/python.py | 0 .../snakeLadder.py | 0 {BoardGame-CLI => boardgame-cli_1}/uno.py | 0 BruteForce.py => bruteforce_1.py | 0 ....py => caesar_cipher_encoder__&_decoder.py | 0 ...e resistance.py => calculate_resistance.py | 0 ...mple ui.py => calculator_with_simple_ui.py | 0 Calendar (GUI) => calendar_(gui) | 0 {Cat => cat_1}/cat.py | 118 ++-- {Cat => cat_1}/text_a.txt | 14 +- {Cat => cat_1}/text_b.txt | 14 +- {Cat => cat_1}/text_c.txt | 6 +- ...k__if_a_number_positive_,_negative_or_zero | 0 ...er_the_string_is_symmetrical_or_palindrome | 0 .../__init__.py | 0 .../assets/crown.png | Bin .../first.py | 0 .../modules/__init__.py | 0 .../modules/checker.py | 0 .../modules/checker_board.py | 0 .../modules/pieces.py | 0 .../modules/statics.py | 0 ...o Automater.py => chrome_dino_automater.py | 0 ...ardMatch.py => classicindiancardmatch_1.py | 0 ...e.py => classification_human_or_horse_1.py | 108 ++-- ...Downloader.py => cliyoutubedownloader_1.py | 176 +++--- .../CliYoutubeDownloader.py | 0 .../requirements.txt | 0 CODE_OF_CONDUCT.md => code_of_conduct_1.md | 0 ...z-Conjecture.py => collatz-conjecture_1.py | 0 {Colors => colors_1}/multicoloredline.py | 0 {Colors => colors_1}/pixel_sort.py | 0 {Colors => colors_1}/primary_colors.py | 0 {Colors => colors_1}/print_colors.py | 0 colour spiral.py => colour_spiral.py | 0 .../PSNR.py | 0 .../compressed_image.png | Bin .../example_image.jpg | Bin .../orignal_image.png | Bin CONTRIBUTING.md => contributing_1.md | 0 Conversation.py => conversation_1.py | 0 ...t.py => convert_celsius_into_fahrenheit.py | 0 ...ch Vowel => count_the_number_of_each_vowel | 0 ...s.py => count_the_numbers_of_two_vovels.py | 0 ...Character.py => countmillioncharacter_1.py | 0 ...-2.0.py => countmillioncharacters-2.0_1.py | 0 .../variation1.py | 0 Crack_password.py => crack_password_1.py | 0 {CRC => crc_1}/crc.py | 110 ++-- ...y => create_password_validity_in_python.py | 46 +- ...Validator.py => credit_card_validator_1.py | 176 +++--- Cricket_score.py => cricket_score_1.py | 0 .../README.md | 0 .../country.txt | 0 .../gui.ui | 0 .../main.py | 0 Day_of_week.py => day_of_week_1.py | 0 ...py => decimal_number_to_binary_function.py | 0 decimal to binary => decimal_to_binary | 0 ...mal_To_Binary.py => decimal_to_binary_1.py | 134 ++-- ..._Linked_List.py => delete_linked_list_1.py | 116 ++-- ..._Remove_loop.py => detect_remove_loop_1.py | 130 ++-- diceV2_dynamic.py => dicev2_dynamic_1.py | 0 ...onary_opperations_(input,update_a_dict).py | 42 +- ...ent model output => different_model_output | 0 ...entiate_List.py => differentiate_list_1.py | 0 Divide Operator.py => divide_operator.py | 0 .../browser_status.py | 0 .../move_to_directory.py | 0 .../obs.py | 0 .../readme.md | 0 .../requirements.txt | 0 .../GamesCalender.py | 140 ++-- {Droplistmenu => droplistmenu_1}/README.md | 0 .../eight_puzzle.py | 0 .../Ohms_law.py | 0 .../resistance.py | 0 Email-Automation.py => email-automation_1.py | 52 +- .../README.md | 0 .../dict1.py | 0 .../mbox-short.txt | 0 .../Images/1.jpg | Bin .../Images/2.jpg | Bin .../Images/3.jpg | Bin .../Images/4.jpg | Bin .../Images/5.jpg | Bin .../Images/6.jpg | Bin .../Images/7.jpg | Bin .../Images/8.jpg | Bin .../Images/9.jpg | Bin .../README.md | 0 .../emoji_dictionary.py | 0 .../requirements.txt | 0 ...ng base64.py => encryption_using_base64.py | 0 EncryptionTool.py => encryptiontool_1.py | 0 even and odd.py => even_and_odd.py | 0 ...on.py => exception_handling_in_python_1.py | 0 .../Parent/Child1/Document_Child1.docx | Bin .../Parent/Child1/Pdf1_Child1.pdf | Bin .../Parent/Child1/Pdf2_Child2.pdf | Bin .../Parent/Child1/Text_Child1.txt | 0 .../Parent/Child2/Document_Child2.docx | Bin .../Parent/Child2/Pdf1_Child2.pdf | Bin .../Parent/Child2/Pdf2_Child2.pdf | Bin .../Parent/Child2/Text_Child2.txt | 0 .../Parent/Child3/Document_Child3.docx | Bin .../Parent/Child3/Pdf1_Child3.pdf | Bin .../Parent/Child3/Pdf2_Child3.pdf | Bin .../Parent/Child3/Text_Child3.txt | 0 .../main.py | 0 ...m_image.py => extract_text_from_image_1.py | 0 .../face_recofnation_first.py | 0 .../gesture_control.py | 0 .../haarcascade_frontalface_default.xml | 0 .../Resources/keras_model.h5 | Bin .../mask_detection.py | 0 facebook id hack.py => facebook_id_hack.py | 0 ...y => fibonacci_sequence_recursive_sol_1.py | 0 ....py => fibonaccinumberswithgenerators_1.py | 0 fibonici series.py => fibonici_series.py | 0 ...er_of_any_city_using_openweathermap_api.py | 0 ...NUMBER.py => find_factorial_of_a_number.py | 0 finding LCM.py => finding_lcm.py | 0 ...mage.py => findingresolutionofanimage_1.py | 0 FizzBuzz.py => fizzbuzz_1.py | 0 .../.gitignore | 0 .../Background.py | 0 .../Bird.py | 0 .../Flappy Bird.py | 0 .../Images/background.png | Bin .../Images/bird.png | Bin .../Images/exit_button.png | Bin .../Images/original_background.png | Bin .../Images/scoreboard.png | Bin .../Images/start_button.png | Bin .../Images/title.png | Bin .../Images/tube.png | Bin .../Images/tube_mouth.png | Bin .../README.md | 0 .../Settings.py | 0 .../Tubes.py | 0 .../README.md | 0 .../flappy_bird.py | 550 ++++++++-------- .../images/background.png | Bin .../images/bird.gif | Bin .../images/bird_wing_down.png | Bin .../images/bird_wing_up.png | Bin .../images/ground.png | Bin .../images/pipe.png | Bin .../images/pipe_body.png | Bin .../images/pipe_end.png | Bin FTP in python => ftp_in_python | 0 ...generate_a_random_number_between_0_to_9.py | 0 get_likes_on_FB.py => get_likes_on_fb_1.py | 0 .../create_dir.py | 0 .../image_grapper.py | 0 Google_News.py => google_news_1.py | 0 ...ian_Calendar.py => gregorian_calendar_1.py | 0 ...ery calculator.py => grocery_calculator.py | 0 GroupSms_Way2.py => groupsms_way2_1.py | 0 ...mber_game.py => guess_the_number_game_1.py | 0 Guessing_Game.py => guessing_game_1.py | 0 .../hand_motion_recognizer.py | 0 .../requirements.txt | 0 Hangman.py => hangman_1.py | 0 HangMan Game => hangman_game | 0 Hotel-Management.py => hotel-management_1.py | 0 ...d_three_numbers_and_find_type_in_python.py | 0 ...display_the_fibonacci_sequence_up_to_n-.py | 0 Image_resize.py => image_resize_1.py | 0 .../img_downloader.py | 0 .../requirements.txt | 0 Infix_to_Postfix.py => infix_to_postfix_1.py | 0 ...29.python => inheritance_yahv1729_1.python | 0 ....py => input_matrice,product_any_order!.py | 138 ++-- ...py => insert_operation_on_linked_list_1.py | 112 ++-- {JARVIS => jarvis_1}/JARVIS.py | 0 {JARVIS => jarvis_1}/README.md | 0 {JARVIS => jarvis_1}/requirements.txt | 0 Job_scheduling.py => job_scheduling_1.py | 0 JsonParser.py => jsonparser_1.py | 0 .../Justdial Scrapper GUI.py | 0 {Key_Binding => key_binding_1}/key_binding.py | 0 .../requirement.txt | 0 Kilometerstomile.py => kilometerstomile_1.py | 0 {Koch Curve => koch_curve}/README.txt | 74 +-- {Koch Curve => koch_curve}/koch curve.py | 72 +-- {Koch Curve => koch_curve}/output_2.mp4 | Bin leap year.py => leap_year.py | 0 Letter_Counter.py => letter_counter_1.py | 0 LETTER GUESSER => letter_guesser | 0 LICENSE.md => license_1.md | 0 linear search.py => linear_search_1.py | 0 List.py => list_1.py | 70 +- Luhn_Algorithm.py => luhn_algorithm_1.py | 136 ++-- ...Libs Generator.py => mad_libs_generator.py | 0 Memory_game.py => memory_game_1.py | 0 ...e_linked_list.py => merge_linked_list_1.py | 0 ...rom list.py => missing_number_from_list.py | 0 ...diction.ipynb => ml_house_prediction.ipynb | 0 ...rapper.py => mobilephonespecsscrapper_1.py | 0 MobiusFunction.py => mobiusfunction_1.py | 0 Model Usage.ipynb => model_usage.ipynb | 0 Monitor Apache => monitor_apache | 0 Mp3_media_player.py => mp3_media_player_1.py | 0 Multiply.py => multiply_1.py | 0 my project => my_project | 0 MySQL_Databses.py => mysql_databses_1.py | 0 ...ations.py => ndigitnumbercombinations_1.py | 0 number guessing.py => number_guessing.py | 0 Number reverse.py => number_reverse.py | 0 Organise.py => organise_1.py | 220 +++---- ...rome_Checker.py => palindrome_checker_1.py | 0 .../pass_gen.py | 0 .../requirements.txt | 0 .../requirements_new.txt | 0 passwordGen.py => passwordgen_1.py | 58 +- ...wordGenerator.py => passwordgenerator_1.py | 0 {Patterns => patterns_1}/pattern1.py | 0 {Patterns => patterns_1}/pattern2.py | 0 {Patterns => patterns_1}/pattern3.py | 0 {Patterns => patterns_1}/pattern5.py | 0 {Patterns => patterns_1}/pattern6.py | 34 +- {Patterns => patterns_1}/patterns.py | 0 {PDF => pdf_1}/basic.py | 0 {PDF => pdf_1}/header_footer.py | 0 {PDF => pdf_1}/images.py | 0 {PDF => pdf_1}/images/ss.png | Bin {PDF => pdf_1}/output.pdf | Bin {PDF => pdf_1}/requirements.txt | 0 PDFtoAudiobook.py => pdftoaudiobook_1.py | 0 Polyline.py => polyline_1.py | 0 PONG_GAME.py => pong_game_1.py | 0 {PongPong_Game => pongpong_game_1}/README.md | 0 .../pong/__init__.py | 0 .../pong/ball.py | 0 .../pong/load.py | 0 .../pong/paddle.py | 0 .../pong/rectangle.py | 0 .../pong_game_play.gif | Bin .../pongpong.py | 0 .../requirements.txt | 0 PORT SCANNER.PY => port_scanner.py | 0 positiveNegetive.py => positivenegetive_1.py | 0 Python Distance.py => powers_of_2.py | 0 ...ARD.txt => practiceproject-disregard_1.txt | 0 prime number.py => prime_number_1.py | 0 Prime_number.py => prime_number_2.py | 0 print hello world.py => print_hello_world.py | 0 ...bers.py => print_list_of_even_numbers_1.py | 38 +- ...mbers.py => print_list_of_odd_numbers_1.py | 0 ....py => program_of_reverse_of_any_number.py | 0 ... program_to_print_table_of_given_number.py | 0 ...everse_linked_list(_recursive_solution).py | 0 ...eanTriplets.py => pythagoreantriplets_1.py | 0 ....py => python-array-equilibrium-index_1.py | 0 .../README.md | 4 +- .../client.py | 90 +-- .../server.py | 112 ++-- powers of 2.py => python_distance.py | 0 ...> python_program_for_factorial_of_a_number | 0 ...finding_square_root_for_positive_number.py | 0 ...uct_of_unique_prime_factors_of_a_number.py | 0 ...py => python_program_for_tower_of_hanoi.py | 0 ...ogram_to_count_the_number_of_each_vowel.py | 0 ...play_fibonacci_sequence_using_recursion.py | 0 ...nd LCM.py => python_program_to_find_lcm.py | 0 ...ils.py => python_program_to_merge_mails.py | 0 ...program_to_print_the_fibonacci_sequence.py | 0 ...am_to_remove_punctuations_from_a_string.py | 0 ...python_program_to_reverse_a_linked_list.py | 0 ...ogram_to_sort_words_in_alphabetic_order.py | 0 ...=> python_program_to_transpose_a_matrix.py | 0 ...er game.py => python_space_invader_game.py | 0 Python_swapping.py => python_swapping_1.py | 0 ...ownloader.py => pythonvideodownloader_1.py | 0 .../qrcode.py | 0 QuadraticCalc.py => quadraticcalc_1.py | 88 +-- ...nerator.py => random_password_generator.py | 0 RandomDice.py => randomdice_1.py | 0 Randomnumber.py => randomnumber_1.py | 0 RandomNumberGame.py => randomnumbergame_1.py | 0 ReadFromCSV.py => readfromcsv_1.py | 40 +- README.md => readme_1.md | 0 .../.recursionVisualizer.py.swp | Bin .../Meshimproved.PNG | Bin .../fencedmesh.PNG | Bin .../git | 0 .../recursionVisualizer.py | 0 recursiveStrings.py => recursivestrings_1.py | 0 ...ove_a_character_from_a_file_and_rewrite.py | 0 ...n_groups.py => reverse_list_in_groups_1.py | 110 ++-- ..._Linked_List.py => rotate_linked_list_1.py | 114 ++-- ...secret_message_generator_gui_by_tkinter.py | 0 Shivaansh.py => shivaansh_1.py | 10 +- ... => shortest_distance_between_two_lines.py | 0 ...le calculator.py => simple_calculator_1.py | 0 ...le_Calculator.py => simple_calculator_2.py | 0 SimpleCalculator.py => simplecalculator_1.py | 0 simpleInterest.py => simpleinterest_1.py | 0 SimpleStopWatch.py => simplestopwatch_1.py | 0 ...r-Gun-Game.py => snake-water-gun-game_1.py | 348 +++++----- .../README.md | 0 .../main.py | 196 +++--- ...=> solution_to_euler_project_problem_10.py | 0 .../Binary_Insertion_Sort.py | 0 .../Bubble_Sorting_Prog.py | 0 .../Bubble_sort.py | 0 .../Count sort.py | 0 .../Counting Sort.py | 0 .../Counting-sort.py | 0 .../Cycle Sort.py | 0 .../Heap sort.py | 0 .../Iterative Merge Sort.py | 0 .../Linear_Insertion_Sort.py | 0 .../Merge Sort.py | 0 .../Merge-sort.py | 0 .../Quick sort.py | 0 .../Shell Sort.py | 0 ... values of first list using second list.py | 0 .../Sorted_Inserted_Linked_List.py | 0 .../SortingAStringAlphabetically.py | 0 .../Sorting_List.py | 0 .../Tim_sort.py | 0 .../brickSort.py | 0 .../bubblesortpgm.py | 0 .../heap_sort.py | 0 .../insertion_sort.py | 0 .../merge_sort.py | 0 .../pigeonhole_sort.py | 0 .../quick_sort.py | 0 .../recursive-quick-sort.py | 0 .../selectionSort.py | 0 .../selection_sort.py | 0 .../sorting.py | 0 .../stooge_sort.py | 0 .../wave_sort.py | 0 SOUNDEX.py => soundex_1.py | 0 ...List.py => split_circular_linked_list_1.py | 134 ++-- spotifyAccount.py => spotifyaccount_1.py | 0 stackF_Harsh2255.py => stackf_harsh2255_1.py | 0 ...ng_Palindrome.py => string_palindrome_1.py | 0 Strings.py => strings_1.py | 0 StringToBinary.py => stringtobinary_1.py | 0 ... number.py => sum_of_digits_of_a_number.py | 0 sWAP_cASE.py => swap_case_1.py | 0 Swap numbers.py => swap_numbers.py | 0 ... of two numbers => swapping_of_two_numbers | 0 .../test_case.py | 0 text to speech => text_to_speech | 0 Tic_Tac_Toe.py => tic_tac_toe_1.py | 0 TicTacToe.py => tictactoe_1.py | 0 ...Operations.py => timetable_operations_1.py | 0 to check leap year => to_check_leap_year | 0 ...nd_the_largest_number_between_3_numbers.py | 0 ...y => to_print_series_1,12,123,1234......py | 0 ... translation_of_sizes_of_underwear_ru_1.py | 0 {Translator => translator_1}/README.md | 0 {Translator => translator_1}/translator.py | 0 .../Readme.md | 0 .../find_Triplets_with_zero_sum.py | 0 TTS.py => tts_1.py | 62 +- .../audiobook_gen.py | 40 +- .../requirements.txt | 0 turtal game.ipynb => turtal_game.ipynb | 0 turtle module => turtle_module | 0 Turtle_Star.py => turtle_star_1.py | 0 ...e-Processing.py => tweet_pre-processing.py | 0 ...ngle.py => type_of_angles_of_a_triangle.py | 0 ...ngle.py => type_of_angles_of_triangle_1.py | 0 {UI-Apps => ui-apps_1}/README.md | 0 {UI-Apps => ui-apps_1}/clock.py | 0 ...py => unit_digit_of_a_raised_to_power_b.py | 0 Untitled.ipynb => untitled_1.ipynb | 0 ...lculator.py => voice_command_calculator.py | 0 .../DOCUMENTATION.md | 156 ++--- {VoiceAssistant => voiceassistant_1}/GUIDE.md | 86 +-- .../PRE-REQUISITES.md | 80 +-- .../Project_Basic_struct/TextTospeech.py | 30 +- .../VoiceAssistant_main.py | 156 ++--- .../Project_Basic_struct/dictator.py | 92 +-- .../Project_Basic_struct/menu.py | 52 +- .../Project_Basic_struct/speakListen.py | 338 +++++----- .../Project_Basic_struct/speechtotext.py | 20 +- .../Project_Basic_struct/textRead.py | 596 +++++++++--------- .../Project_Basic_struct/websiteWork.py | 124 ++-- .../README.md | 192 +++--- .../__main__.py | 0 {VoiceRepeater => voicerepeater_1}/readme.md | 0 ...r function.py => vowel_remover_function.py | 0 .../weather.csv | 16 +- .../weather.py | 0 WeatherGUI.py => weathergui_1.py | 128 ++-- Web_Scraper.py => web_scraper_1.py | 0 Web Socket.py => web_socket.py | 0 {Webbrowser => webbrowser_1}/tk-browser.py | 0 ... brutefore.py => wifi_hack_by_brutefore.py | 0 WikipediaModule.py => wikipediamodule_1.py | 0 .../ReadMe.md | 0 ...ab960b991231639dabe5bc817e1d9395a39694.jpg | Bin ...f6474242963dbb9fe315ec4ecd44de8f3702c8.jpg | Bin ...68dbb3fc41a7e1c160605539abd1bcd29625af.jpg | Bin ...e32ee205649af2051eb75f40b00f4d5a42b7b9.jpg | Bin ...42736c7bbc74299469b7df734254d28e026dc4.jpg | Bin ...3f911de31440d589e329d04576e571a54b8851.jpg | Bin .../wallpaper_extract.py | 0 .../5 letter word dictionary.txt | 0 {Wordle => wordle_1}/Dictionary.txt | 0 {Wordle => wordle_1}/wordle.py | 0 {XML => xml_1}/HTML parsing | 0 {XORcipher => xorcipher_1}/README.md | 0 {XORcipher => xorcipher_1}/XOR_cipher.py | 0 {XORcipher => xorcipher_1}/test_XOR_cipher.py | 0 .../Screenshot (138).png | Bin .../main.py | 0 .../photo.jpg | Bin .../photo.png | Bin .../youtube-ios-app.ico | Bin 475 files changed, 3868 insertions(+), 3868 deletions(-) rename {1 File handle => 1_file_handle}/File handle binary/Deleting record in a binary file.py (95%) rename {1 File handle => 1_file_handle}/File handle binary/File handle binary read (record in non list form).py (95%) rename {1 File handle => 1_file_handle}/File handle binary/Update a binary file.py (94%) rename {1 File handle => 1_file_handle}/File handle binary/Update a binary file2.py (95%) rename {1 File handle => 1_file_handle}/File handle binary/class.dat (100%) rename {1 File handle => 1_file_handle}/File handle binary/question 1 (elegible for remedial, top marks).py (95%) rename {1 File handle => 1_file_handle}/File handle binary/search record in binary file.py (95%) rename {1 File handle => 1_file_handle}/File handle binary/studrec.dat (100%) rename {1 File handle => 1_file_handle}/File handle text/file handle 12 length of line in text file.py (96%) rename {1 File handle => 1_file_handle}/File handle text/happy.txt (96%) rename {1 File handle => 1_file_handle}/File handle text/input,output and error streams.py (96%) rename {1 File handle => 1_file_handle}/File handle text/question 2.py (96%) rename {1 File handle => 1_file_handle}/File handle text/question 5.py (96%) rename {1 File handle => 1_file_handle}/File handle text/question 6.py (97%) rename {1 File handle => 1_file_handle}/File handle text/question3.py (96%) rename {1 File handle => 1_file_handle}/File handle text/special symbol after word.py (94%) rename {1 File handle => 1_file_handle}/File handle text/story.txt (97%) rename A solution to project euler problem 3.py => a_solution_to_project_euler_problem_3.py (100%) rename add 2 number.py => add_2_number.py (100%) rename add 2 numbers.py => add_2_numbers.py (100%) rename Add_two_Linked_List.py => add_two_linked_list_1.py (96%) rename add two no.py => add_two_no.py (100%) rename add two number.py => add_two_number.py (100%) rename Add two numbers.py => add_two_numbers.py (100%) rename Addtion of two numbers.py => addtion_of_two_numbers.py (100%) rename AREA OF TRIANGLE.py => area_of_triangle.py (100%) rename AreaOfTriangle.py => areaoftriangle_1.py (100%) rename ARKA.py => arka_1.py (100%) rename Armstrong_number => armstrong_number_1 (100%) rename Armstrong_number.py => armstrong_number_1.py (95%) rename ASCIIvaluecharacter.py => asciivaluecharacter_1.py (100%) rename {Assembler => assembler_1}/GUIDE.txt (100%) rename {Assembler => assembler_1}/README.md (100%) rename {Assembler => assembler_1}/assembler.py (100%) rename {Assembler => assembler_1}/examples/code.txt (100%) rename {Assembler => assembler_1}/examples/code2.txt (100%) rename {Assembler => assembler_1}/examples/code3.txt (100%) rename {Assembler => assembler_1}/examples/code4.txt (100%) rename {Assembler => assembler_1}/examples/test.txt (100%) rename {Assembler => assembler_1}/requirements.txt (100%) rename {Automated Scheduled Call Reminders => automated_scheduled_call_reminders}/caller.py (100%) rename {Automated Scheduled Call Reminders => automated_scheduled_call_reminders}/requirements.txt (100%) rename {Automated Scheduled Call Reminders => automated_scheduled_call_reminders}/schedular.py (100%) rename Bank Application .ipynb => bank_application_.ipynb (100%) rename Base Converter Number system.py => base_converter_number_system.py (100%) rename basic example => basic_example (100%) rename Battery_notifier.py => battery_notifier_1.py (100%) rename Binary Coefficients.py => binary_coefficients.py (100%) rename binary search.py => binary_search_1.py (100%) rename Binary_search.py => binary_search_2.py (100%) rename Binary_to_Decimal.py => binary_to_decimal_1.py (100%) rename binarySTree isTrue_YashV1729.Java => binarystree_istrue_yashv1729.java (100%) rename {BlackJack_game => blackjack_game_1}/blackjack.py (100%) rename {BlackJack_game => blackjack_game_1}/blackjack_rr.py (100%) rename {BlackJack_game => blackjack_game_1}/blackjack_simulate.py (100%) rename {BlackJack_game => blackjack_game_1}/requirements.txt (100%) rename blackJackGUI.py => blackjackgui_1.py (96%) rename {BoardGame-CLI => boardgame-cli_1}/python.py (100%) rename {BoardGame-CLI => boardgame-cli_1}/snakeLadder.py (100%) rename {BoardGame-CLI => boardgame-cli_1}/uno.py (100%) rename BruteForce.py => bruteforce_1.py (100%) rename Caesar Cipher Encoder & Decoder.py => caesar_cipher_encoder__&_decoder.py (100%) rename Calculate resistance.py => calculate_resistance.py (100%) rename Calculator with simple ui.py => calculator_with_simple_ui.py (100%) rename Calendar (GUI) => calendar_(gui) (100%) rename {Cat => cat_1}/cat.py (96%) rename {Cat => cat_1}/text_a.txt (91%) rename {Cat => cat_1}/text_b.txt (94%) rename {Cat => cat_1}/text_c.txt (95%) rename check if a number positive , negative or zero => check__if_a_number_positive_,_negative_or_zero (100%) rename check whether the string is Symmetrical or Palindrome => check_whether_the_string_is_symmetrical_or_palindrome (100%) rename {Checker_game_by_dz => checker_game_by_dz_1}/__init__.py (100%) rename {Checker_game_by_dz => checker_game_by_dz_1}/assets/crown.png (100%) rename {Checker_game_by_dz => checker_game_by_dz_1}/first.py (100%) rename {Checker_game_by_dz => checker_game_by_dz_1}/modules/__init__.py (100%) rename {Checker_game_by_dz => checker_game_by_dz_1}/modules/checker.py (100%) rename {Checker_game_by_dz => checker_game_by_dz_1}/modules/checker_board.py (100%) rename {Checker_game_by_dz => checker_game_by_dz_1}/modules/pieces.py (100%) rename {Checker_game_by_dz => checker_game_by_dz_1}/modules/statics.py (100%) rename Chrome Dino Automater.py => chrome_dino_automater.py (100%) rename classicIndianCardMatch.py => classicindiancardmatch_1.py (100%) rename Classification_human_or_horse.py => classification_human_or_horse_1.py (96%) rename CliYoutubeDownloader.py => cliyoutubedownloader_1.py (96%) rename {CliYoutubeDownloader => cliyoutubedownloader_1}/CliYoutubeDownloader.py (100%) rename {CliYoutubeDownloader => cliyoutubedownloader_1}/requirements.txt (100%) rename CODE_OF_CONDUCT.md => code_of_conduct_1.md (100%) rename Collatz-Conjecture.py => collatz-conjecture_1.py (100%) rename {Colors => colors_1}/multicoloredline.py (100%) rename {Colors => colors_1}/pixel_sort.py (100%) rename {Colors => colors_1}/primary_colors.py (100%) rename {Colors => colors_1}/print_colors.py (100%) rename colour spiral.py => colour_spiral.py (100%) rename {Compression_Analysis => compression_analysis_1}/PSNR.py (100%) rename {Compression_Analysis => compression_analysis_1}/compressed_image.png (100%) rename {Compression_Analysis => compression_analysis_1}/example_image.jpg (100%) rename {Compression_Analysis => compression_analysis_1}/orignal_image.png (100%) rename CONTRIBUTING.md => contributing_1.md (100%) rename Conversation.py => conversation_1.py (100%) rename convert celsius into fahrenheit.py => convert_celsius_into_fahrenheit.py (100%) rename Count the Number of Each Vowel => count_the_number_of_each_vowel (100%) rename count the numbers of two vovels.py => count_the_numbers_of_two_vovels.py (100%) rename CountMillionCharacter.py => countmillioncharacter_1.py (100%) rename CountMillionCharacters-2.0.py => countmillioncharacters-2.0_1.py (100%) rename {CountMillionCharacters-Variations => countmillioncharacters-variations_1}/variation1.py (100%) rename Crack_password.py => crack_password_1.py (100%) rename {CRC => crc_1}/crc.py (96%) rename create password validity in python.py => create_password_validity_in_python.py (95%) rename Credit_Card_Validator.py => credit_card_validator_1.py (96%) rename Cricket_score.py => cricket_score_1.py (100%) rename {currency converter => currency_converter}/README.md (100%) rename {currency converter => currency_converter}/country.txt (100%) rename {currency converter => currency_converter}/gui.ui (100%) rename {currency converter => currency_converter}/main.py (100%) rename Day_of_week.py => day_of_week_1.py (100%) rename Decimal number to binary function.py => decimal_number_to_binary_function.py (100%) rename decimal to binary => decimal_to_binary (100%) rename Decimal_To_Binary.py => decimal_to_binary_1.py (95%) rename Delete_Linked_List.py => delete_linked_list_1.py (96%) rename Detect_Remove_loop.py => detect_remove_loop_1.py (96%) rename diceV2_dynamic.py => dicev2_dynamic_1.py (100%) rename Dictionary opperations (input,update a dict).py => dictionary_opperations_(input,update_a_dict).py (95%) rename different model output => different_model_output (100%) rename Differentiate_List.py => differentiate_list_1.py (100%) rename Divide Operator.py => divide_operator.py (100%) rename {Downloaded Files Organizer => downloaded_files_organizer}/browser_status.py (100%) rename {Downloaded Files Organizer => downloaded_files_organizer}/move_to_directory.py (100%) rename {Downloaded Files Organizer => downloaded_files_organizer}/obs.py (100%) rename {Downloaded Files Organizer => downloaded_files_organizer}/readme.md (100%) rename {Downloaded Files Organizer => downloaded_files_organizer}/requirements.txt (100%) rename {Droplistmenu => droplistmenu_1}/GamesCalender.py (95%) rename {Droplistmenu => droplistmenu_1}/README.md (100%) rename {Eight_Puzzle_Solver => eight_puzzle_solver_1}/eight_puzzle.py (100%) rename {Electronics_Algorithms => electronics_algorithms_1}/Ohms_law.py (100%) rename {Electronics_Algorithms => electronics_algorithms_1}/resistance.py (100%) rename Email-Automation.py => email-automation_1.py (95%) rename {email id dictionary => email_id_dictionary}/README.md (100%) rename {email id dictionary => email_id_dictionary}/dict1.py (100%) rename {email id dictionary => email_id_dictionary}/mbox-short.txt (100%) rename {Emoji Dictionary => emoji_dictionary}/Images/1.jpg (100%) rename {Emoji Dictionary => emoji_dictionary}/Images/2.jpg (100%) rename {Emoji Dictionary => emoji_dictionary}/Images/3.jpg (100%) rename {Emoji Dictionary => emoji_dictionary}/Images/4.jpg (100%) rename {Emoji Dictionary => emoji_dictionary}/Images/5.jpg (100%) rename {Emoji Dictionary => emoji_dictionary}/Images/6.jpg (100%) rename {Emoji Dictionary => emoji_dictionary}/Images/7.jpg (100%) rename {Emoji Dictionary => emoji_dictionary}/Images/8.jpg (100%) rename {Emoji Dictionary => emoji_dictionary}/Images/9.jpg (100%) rename {Emoji Dictionary => emoji_dictionary}/README.md (100%) rename {Emoji Dictionary => emoji_dictionary}/emoji_dictionary.py (100%) rename {Emoji Dictionary => emoji_dictionary}/requirements.txt (100%) rename Encryption using base64.py => encryption_using_base64.py (100%) rename EncryptionTool.py => encryptiontool_1.py (100%) rename even and odd.py => even_and_odd.py (100%) rename Exception_Handling_in_Python.py => exception_handling_in_python_1.py (100%) rename {Extract-Table-from-pdf-txt-docx => extract-table-from-pdf-txt-docx_1}/Parent/Child1/Document_Child1.docx (100%) rename {Extract-Table-from-pdf-txt-docx => extract-table-from-pdf-txt-docx_1}/Parent/Child1/Pdf1_Child1.pdf (100%) rename {Extract-Table-from-pdf-txt-docx => extract-table-from-pdf-txt-docx_1}/Parent/Child1/Pdf2_Child2.pdf (100%) rename {Extract-Table-from-pdf-txt-docx => extract-table-from-pdf-txt-docx_1}/Parent/Child1/Text_Child1.txt (100%) rename {Extract-Table-from-pdf-txt-docx => extract-table-from-pdf-txt-docx_1}/Parent/Child2/Document_Child2.docx (100%) rename {Extract-Table-from-pdf-txt-docx => extract-table-from-pdf-txt-docx_1}/Parent/Child2/Pdf1_Child2.pdf (100%) rename {Extract-Table-from-pdf-txt-docx => extract-table-from-pdf-txt-docx_1}/Parent/Child2/Pdf2_Child2.pdf (100%) rename {Extract-Table-from-pdf-txt-docx => extract-table-from-pdf-txt-docx_1}/Parent/Child2/Text_Child2.txt (100%) rename {Extract-Table-from-pdf-txt-docx => extract-table-from-pdf-txt-docx_1}/Parent/Child3/Document_Child3.docx (100%) rename {Extract-Table-from-pdf-txt-docx => extract-table-from-pdf-txt-docx_1}/Parent/Child3/Pdf1_Child3.pdf (100%) rename {Extract-Table-from-pdf-txt-docx => extract-table-from-pdf-txt-docx_1}/Parent/Child3/Pdf2_Child3.pdf (100%) rename {Extract-Table-from-pdf-txt-docx => extract-table-from-pdf-txt-docx_1}/Parent/Child3/Text_Child3.txt (100%) rename {Extract-Table-from-pdf-txt-docx => extract-table-from-pdf-txt-docx_1}/main.py (100%) rename Extract_Text_from_image.py => extract_text_from_image_1.py (100%) rename {Face and eye Recognition => face_and_eye_recognition}/face_recofnation_first.py (100%) rename {Face and eye Recognition => face_and_eye_recognition}/gesture_control.py (100%) rename {Face_Mask_detection (haarcascade) => face_mask_detection_(haarcascade)}/Resources/haarcascade_frontalface_default.xml (100%) rename {Face_Mask_detection (haarcascade) => face_mask_detection_(haarcascade)}/Resources/keras_model.h5 (100%) rename {Face_Mask_detection (haarcascade) => face_mask_detection_(haarcascade)}/mask_detection.py (100%) rename facebook id hack.py => facebook_id_hack.py (100%) rename Fibonacci_sequence_recursive_sol.py => fibonacci_sequence_recursive_sol_1.py (100%) rename FibonacciNumbersWithGenerators.py => fibonaccinumberswithgenerators_1.py (100%) rename fibonici series.py => fibonici_series.py (100%) rename Find current weather of any city using openweathermap API.py => find_current_weather_of_any_city_using_openweathermap_api.py (100%) rename FIND FACTORIAL OF A NUMBER.py => find_factorial_of_a_number.py (100%) rename finding LCM.py => finding_lcm.py (100%) rename FindingResolutionOfAnImage.py => findingresolutionofanimage_1.py (100%) rename FizzBuzz.py => fizzbuzz_1.py (100%) rename {Flappy Bird - created with tkinter => flappy_bird_-_created_with_tkinter}/.gitignore (100%) rename {Flappy Bird - created with tkinter => flappy_bird_-_created_with_tkinter}/Background.py (100%) rename {Flappy Bird - created with tkinter => flappy_bird_-_created_with_tkinter}/Bird.py (100%) rename {Flappy Bird - created with tkinter => flappy_bird_-_created_with_tkinter}/Flappy Bird.py (100%) rename {Flappy Bird - created with tkinter => flappy_bird_-_created_with_tkinter}/Images/background.png (100%) rename {Flappy Bird - created with tkinter => flappy_bird_-_created_with_tkinter}/Images/bird.png (100%) rename {Flappy Bird - created with tkinter => flappy_bird_-_created_with_tkinter}/Images/exit_button.png (100%) rename {Flappy Bird - created with tkinter => flappy_bird_-_created_with_tkinter}/Images/original_background.png (100%) rename {Flappy Bird - created with tkinter => flappy_bird_-_created_with_tkinter}/Images/scoreboard.png (100%) rename {Flappy Bird - created with tkinter => flappy_bird_-_created_with_tkinter}/Images/start_button.png (100%) rename {Flappy Bird - created with tkinter => flappy_bird_-_created_with_tkinter}/Images/title.png (100%) rename {Flappy Bird - created with tkinter => flappy_bird_-_created_with_tkinter}/Images/tube.png (100%) rename {Flappy Bird - created with tkinter => flappy_bird_-_created_with_tkinter}/Images/tube_mouth.png (100%) rename {Flappy Bird - created with tkinter => flappy_bird_-_created_with_tkinter}/README.md (100%) rename {Flappy Bird - created with tkinter => flappy_bird_-_created_with_tkinter}/Settings.py (100%) rename {Flappy Bird - created with tkinter => flappy_bird_-_created_with_tkinter}/Tubes.py (100%) rename {flappyBird_pygame => flappybird_pygame_1}/README.md (100%) rename {flappyBird_pygame => flappybird_pygame_1}/flappy_bird.py (96%) rename {flappyBird_pygame => flappybird_pygame_1}/images/background.png (100%) rename {flappyBird_pygame => flappybird_pygame_1}/images/bird.gif (100%) rename {flappyBird_pygame => flappybird_pygame_1}/images/bird_wing_down.png (100%) rename {flappyBird_pygame => flappybird_pygame_1}/images/bird_wing_up.png (100%) rename {flappyBird_pygame => flappybird_pygame_1}/images/ground.png (100%) rename {flappyBird_pygame => flappybird_pygame_1}/images/pipe.png (100%) rename {flappyBird_pygame => flappybird_pygame_1}/images/pipe_body.png (100%) rename {flappyBird_pygame => flappybird_pygame_1}/images/pipe_end.png (100%) rename FTP in python => ftp_in_python (100%) rename Generate a random number between 0 to 9.py => generate_a_random_number_between_0_to_9.py (100%) rename get_likes_on_FB.py => get_likes_on_fb_1.py (100%) rename {Google_Image_Downloader => google_image_downloader_1}/create_dir.py (100%) rename {Google_Image_Downloader => google_image_downloader_1}/image_grapper.py (100%) rename Google_News.py => google_news_1.py (100%) rename Gregorian_Calendar.py => gregorian_calendar_1.py (100%) rename Grocery calculator.py => grocery_calculator.py (100%) rename GroupSms_Way2.py => groupsms_way2_1.py (100%) rename Guess_the_number_game.py => guess_the_number_game_1.py (100%) rename Guessing_Game.py => guessing_game_1.py (100%) rename {Hand-Motion-Detection => hand-motion-detection_1}/hand_motion_recognizer.py (100%) rename {Hand-Motion-Detection => hand-motion-detection_1}/requirements.txt (100%) rename Hangman.py => hangman_1.py (100%) rename HangMan Game => hangman_game (100%) rename Hotel-Management.py => hotel-management_1.py (100%) rename how to add three numbers and find type in python.py => how_to_add_three_numbers_and_find_type_in_python.py (100%) rename Python Program to Print the Fibonacci sequence.py => how_to_display_the_fibonacci_sequence_up_to_n-.py (100%) rename Image_resize.py => image_resize_1.py (100%) rename {ImageDownloader => imagedownloader_1}/img_downloader.py (100%) rename {ImageDownloader => imagedownloader_1}/requirements.txt (100%) rename Infix_to_Postfix.py => infix_to_postfix_1.py (100%) rename inheritance_YahV1729.python => inheritance_yahv1729_1.python (100%) rename input matrice,product any order!.py => input_matrice,product_any_order!.py (95%) rename Insert_operation_on_Linked_List.py => insert_operation_on_linked_list_1.py (96%) rename {JARVIS => jarvis_1}/JARVIS.py (100%) rename {JARVIS => jarvis_1}/README.md (100%) rename {JARVIS => jarvis_1}/requirements.txt (100%) rename Job_scheduling.py => job_scheduling_1.py (100%) rename JsonParser.py => jsonparser_1.py (100%) rename {JustDialScrapperGUI => justdialscrappergui_1}/Justdial Scrapper GUI.py (100%) rename {Key_Binding => key_binding_1}/key_binding.py (100%) rename {Key_Binding => key_binding_1}/requirement.txt (100%) rename Kilometerstomile.py => kilometerstomile_1.py (100%) rename {Koch Curve => koch_curve}/README.txt (98%) rename {Koch Curve => koch_curve}/koch curve.py (96%) rename {Koch Curve => koch_curve}/output_2.mp4 (100%) rename leap year.py => leap_year.py (100%) rename Letter_Counter.py => letter_counter_1.py (100%) rename LETTER GUESSER => letter_guesser (100%) rename LICENSE.md => license_1.md (100%) rename linear search.py => linear_search_1.py (100%) rename List.py => list_1.py (94%) rename Luhn_Algorithm.py => luhn_algorithm_1.py (96%) rename Mad Libs Generator.py => mad_libs_generator.py (100%) rename Memory_game.py => memory_game_1.py (100%) rename Merge_linked_list.py => merge_linked_list_1.py (100%) rename missing number from list.py => missing_number_from_list.py (100%) rename ML House Prediction.ipynb => ml_house_prediction.ipynb (100%) rename mobilePhoneSpecsScrapper.py => mobilephonespecsscrapper_1.py (100%) rename MobiusFunction.py => mobiusfunction_1.py (100%) rename Model Usage.ipynb => model_usage.ipynb (100%) rename Monitor Apache => monitor_apache (100%) rename Mp3_media_player.py => mp3_media_player_1.py (100%) rename Multiply.py => multiply_1.py (100%) rename my project => my_project (100%) rename MySQL_Databses.py => mysql_databses_1.py (100%) rename nDigitNumberCombinations.py => ndigitnumbercombinations_1.py (100%) rename number guessing.py => number_guessing.py (100%) rename Number reverse.py => number_reverse.py (100%) rename Organise.py => organise_1.py (95%) rename Palindrome_Checker.py => palindrome_checker_1.py (100%) rename {Password Generator => password_generator}/pass_gen.py (100%) rename {Password Generator => password_generator}/requirements.txt (100%) rename {Password Generator => password_generator}/requirements_new.txt (100%) rename passwordGen.py => passwordgen_1.py (96%) rename passwordGenerator.py => passwordgenerator_1.py (100%) rename {Patterns => patterns_1}/pattern1.py (100%) rename {Patterns => patterns_1}/pattern2.py (100%) rename {Patterns => patterns_1}/pattern3.py (100%) rename {Patterns => patterns_1}/pattern5.py (100%) rename {Patterns => patterns_1}/pattern6.py (94%) rename {Patterns => patterns_1}/patterns.py (100%) rename {PDF => pdf_1}/basic.py (100%) rename {PDF => pdf_1}/header_footer.py (100%) rename {PDF => pdf_1}/images.py (100%) rename {PDF => pdf_1}/images/ss.png (100%) rename {PDF => pdf_1}/output.pdf (100%) rename {PDF => pdf_1}/requirements.txt (100%) rename PDFtoAudiobook.py => pdftoaudiobook_1.py (100%) rename Polyline.py => polyline_1.py (100%) rename PONG_GAME.py => pong_game_1.py (100%) rename {PongPong_Game => pongpong_game_1}/README.md (100%) rename {PongPong_Game => pongpong_game_1}/pong/__init__.py (100%) rename {PongPong_Game => pongpong_game_1}/pong/ball.py (100%) rename {PongPong_Game => pongpong_game_1}/pong/load.py (100%) rename {PongPong_Game => pongpong_game_1}/pong/paddle.py (100%) rename {PongPong_Game => pongpong_game_1}/pong/rectangle.py (100%) rename {PongPong_Game => pongpong_game_1}/pong_game_play.gif (100%) rename {PongPong_Game => pongpong_game_1}/pongpong.py (100%) rename {PongPong_Game => pongpong_game_1}/requirements.txt (100%) rename PORT SCANNER.PY => port_scanner.py (100%) rename positiveNegetive.py => positivenegetive_1.py (100%) rename Python Distance.py => powers_of_2.py (100%) rename PRACTICEPROJECT-DISREGARD.txt => practiceproject-disregard_1.txt (100%) rename prime number.py => prime_number_1.py (100%) rename Prime_number.py => prime_number_2.py (100%) rename print hello world.py => print_hello_world.py (100%) rename Print_List_of_Even_Numbers.py => print_list_of_even_numbers_1.py (96%) rename Print_List_of_Odd_Numbers.py => print_list_of_odd_numbers_1.py (100%) rename Program of Reverse of any number.py => program_of_reverse_of_any_number.py (100%) rename Program to print table of given number.py => program_to_print_table_of_given_number.py (100%) rename Program to reverse Linked List( Recursive solution).py => program_to_reverse_linked_list(_recursive_solution).py (100%) rename pythagoreanTriplets.py => pythagoreantriplets_1.py (100%) rename Python-Array-Equilibrium-Index.py => python-array-equilibrium-index_1.py (100%) rename {Python_chatting_application => python_chatting_application_1}/README.md (96%) rename {Python_chatting_application => python_chatting_application_1}/client.py (96%) rename {Python_chatting_application => python_chatting_application_1}/server.py (96%) rename powers of 2.py => python_distance.py (100%) rename Python Program for factorial of a number => python_program_for_factorial_of_a_number (100%) rename python program for finding square root for positive number.py => python_program_for_finding_square_root_for_positive_number.py (100%) rename Python Program for Product of unique prime factors of a number.py => python_program_for_product_of_unique_prime_factors_of_a_number.py (100%) rename Python Program for Tower of Hanoi.py => python_program_for_tower_of_hanoi.py (100%) rename Python Program to Count the Number of Each Vowel.py => python_program_to_count_the_number_of_each_vowel.py (100%) rename Python Program to Display Fibonacci Sequence Using Recursion.py => python_program_to_display_fibonacci_sequence_using_recursion.py (100%) rename Python Program to Find LCM.py => python_program_to_find_lcm.py (100%) rename Python Program to Merge Mails.py => python_program_to_merge_mails.py (100%) rename how to display the fibonacci sequence up to n-.py => python_program_to_print_the_fibonacci_sequence.py (100%) rename Python Program to Remove Punctuations from a String.py => python_program_to_remove_punctuations_from_a_string.py (100%) rename Python Program to Reverse a linked list.py => python_program_to_reverse_a_linked_list.py (100%) rename Python Program to Sort Words in Alphabetic Order.py => python_program_to_sort_words_in_alphabetic_order.py (100%) rename Python Program to Transpose a Matrix.py => python_program_to_transpose_a_matrix.py (100%) rename python Space Invader game.py => python_space_invader_game.py (100%) rename Python_swapping.py => python_swapping_1.py (100%) rename pythonVideoDownloader.py => pythonvideodownloader_1.py (100%) rename {QR_code_generator => qr_code_generator_1}/qrcode.py (100%) mode change 100755 => 100644 rename QuadraticCalc.py => quadraticcalc_1.py (96%) rename Random Password Generator.py => random_password_generator.py (100%) rename RandomDice.py => randomdice_1.py (100%) rename Randomnumber.py => randomnumber_1.py (100%) rename RandomNumberGame.py => randomnumbergame_1.py (100%) rename ReadFromCSV.py => readfromcsv_1.py (97%) rename README.md => readme_1.md (100%) rename {Recursion Visulaizer => recursion_visulaizer}/.recursionVisualizer.py.swp (100%) rename {Recursion Visulaizer => recursion_visulaizer}/Meshimproved.PNG (100%) rename {Recursion Visulaizer => recursion_visulaizer}/fencedmesh.PNG (100%) rename {Recursion Visulaizer => recursion_visulaizer}/git (100%) rename {Recursion Visulaizer => recursion_visulaizer}/recursionVisualizer.py (100%) rename recursiveStrings.py => recursivestrings_1.py (100%) rename remove a character from a file and rewrite.py => remove_a_character_from_a_file_and_rewrite.py (100%) rename Reverse_list_in_groups.py => reverse_list_in_groups_1.py (96%) rename Rotate_Linked_List.py => rotate_linked_list_1.py (96%) rename Secret message generator GUI by tkinter.py => secret_message_generator_gui_by_tkinter.py (100%) rename Shivaansh.py => shivaansh_1.py (96%) rename Shortest Distance between Two Lines.py => shortest_distance_between_two_lines.py (100%) rename Simple calculator.py => simple_calculator_1.py (100%) rename Simple_Calculator.py => simple_calculator_2.py (100%) rename SimpleCalculator.py => simplecalculator_1.py (100%) rename simpleInterest.py => simpleinterest_1.py (100%) rename SimpleStopWatch.py => simplestopwatch_1.py (100%) rename Snake-Water-Gun-Game.py => snake-water-gun-game_1.py (96%) rename {Snake_water_gun => snake_water_gun_1}/README.md (100%) rename {Snake_water_gun => snake_water_gun_1}/main.py (96%) rename solution to euler project problem 10.py => solution_to_euler_project_problem_10.py (100%) rename {Sorting Algorithms => sorting_algorithms}/Binary_Insertion_Sort.py (100%) rename {Sorting Algorithms => sorting_algorithms}/Bubble_Sorting_Prog.py (100%) rename {Sorting Algorithms => sorting_algorithms}/Bubble_sort.py (100%) rename {Sorting Algorithms => sorting_algorithms}/Count sort.py (100%) rename {Sorting Algorithms => sorting_algorithms}/Counting Sort.py (100%) rename {Sorting Algorithms => sorting_algorithms}/Counting-sort.py (100%) rename {Sorting Algorithms => sorting_algorithms}/Cycle Sort.py (100%) rename {Sorting Algorithms => sorting_algorithms}/Heap sort.py (100%) rename {Sorting Algorithms => sorting_algorithms}/Iterative Merge Sort.py (100%) rename {Sorting Algorithms => sorting_algorithms}/Linear_Insertion_Sort.py (100%) rename {Sorting Algorithms => sorting_algorithms}/Merge Sort.py (100%) rename {Sorting Algorithms => sorting_algorithms}/Merge-sort.py (100%) rename {Sorting Algorithms => sorting_algorithms}/Quick sort.py (100%) rename {Sorting Algorithms => sorting_algorithms}/Shell Sort.py (100%) rename {Sorting Algorithms => sorting_algorithms}/Sort the values of first list using second list.py (100%) rename {Sorting Algorithms => sorting_algorithms}/Sorted_Inserted_Linked_List.py (100%) rename {Sorting Algorithms => sorting_algorithms}/SortingAStringAlphabetically.py (100%) rename {Sorting Algorithms => sorting_algorithms}/Sorting_List.py (100%) rename {Sorting Algorithms => sorting_algorithms}/Tim_sort.py (100%) rename {Sorting Algorithms => sorting_algorithms}/brickSort.py (100%) rename {Sorting Algorithms => sorting_algorithms}/bubblesortpgm.py (100%) rename {Sorting Algorithms => sorting_algorithms}/heap_sort.py (100%) rename {Sorting Algorithms => sorting_algorithms}/insertion_sort.py (100%) rename {Sorting Algorithms => sorting_algorithms}/merge_sort.py (100%) rename {Sorting Algorithms => sorting_algorithms}/pigeonhole_sort.py (100%) rename {Sorting Algorithms => sorting_algorithms}/quick_sort.py (100%) rename {Sorting Algorithms => sorting_algorithms}/recursive-quick-sort.py (100%) rename {Sorting Algorithms => sorting_algorithms}/selectionSort.py (100%) rename {Sorting Algorithms => sorting_algorithms}/selection_sort.py (100%) rename {Sorting Algorithms => sorting_algorithms}/sorting.py (100%) rename {Sorting Algorithms => sorting_algorithms}/stooge_sort.py (100%) rename {Sorting Algorithms => sorting_algorithms}/wave_sort.py (100%) rename SOUNDEX.py => soundex_1.py (100%) rename Split_Circular_Linked_List.py => split_circular_linked_list_1.py (96%) rename spotifyAccount.py => spotifyaccount_1.py (100%) rename stackF_Harsh2255.py => stackf_harsh2255_1.py (100%) rename String_Palindrome.py => string_palindrome_1.py (100%) rename Strings.py => strings_1.py (100%) rename StringToBinary.py => stringtobinary_1.py (100%) rename Sum of digits of a number.py => sum_of_digits_of_a_number.py (100%) rename sWAP_cASE.py => swap_case_1.py (100%) rename Swap numbers.py => swap_numbers.py (100%) rename swapping of two numbers => swapping_of_two_numbers (100%) rename {Test-Case-Generator => test-case-generator_1}/test_case.py (100%) rename text to speech => text_to_speech (100%) rename Tic_Tac_Toe.py => tic_tac_toe_1.py (100%) rename TicTacToe.py => tictactoe_1.py (100%) rename Timetable_Operations.py => timetable_operations_1.py (100%) rename to check leap year => to_check_leap_year (100%) rename To find the largest number between 3 numbers.py => to_find_the_largest_number_between_3_numbers.py (100%) rename To print series 1,12,123,1234......py => to_print_series_1,12,123,1234......py (100%) rename translation_of_sizes_of_underwear_RU.py => translation_of_sizes_of_underwear_ru_1.py (100%) rename {Translator => translator_1}/README.md (100%) rename {Translator => translator_1}/translator.py (100%) rename {Triplets with zero sum => triplets_with_zero_sum}/Readme.md (100%) rename {Triplets with zero sum => triplets_with_zero_sum}/find_Triplets_with_zero_sum.py (100%) rename TTS.py => tts_1.py (96%) rename {Turn your PDFs into audio books => turn_your_pdfs_into_audio_books}/audiobook_gen.py (95%) rename {Turn your PDFs into audio books => turn_your_pdfs_into_audio_books}/requirements.txt (100%) rename turtal game.ipynb => turtal_game.ipynb (100%) rename turtle module => turtle_module (100%) rename Turtle_Star.py => turtle_star_1.py (100%) rename Tweet Pre-Processing.py => tweet_pre-processing.py (100%) rename Type of angles of a triangle.py => type_of_angles_of_a_triangle.py (100%) rename Type_of_angles_of_triangle.py => type_of_angles_of_triangle_1.py (100%) rename {UI-Apps => ui-apps_1}/README.md (100%) rename {UI-Apps => ui-apps_1}/clock.py (100%) rename Unit Digit of a raised to power b.py => unit_digit_of_a_raised_to_power_b.py (100%) rename Untitled.ipynb => untitled_1.ipynb (100%) rename Voice Command Calculator.py => voice_command_calculator.py (100%) rename {VoiceAssistant => voiceassistant_1}/DOCUMENTATION.md (98%) rename {VoiceAssistant => voiceassistant_1}/GUIDE.md (98%) rename {VoiceAssistant => voiceassistant_1}/PRE-REQUISITES.md (97%) rename {VoiceAssistant => voiceassistant_1}/Project_Basic_struct/TextTospeech.py (95%) rename {VoiceAssistant => voiceassistant_1}/Project_Basic_struct/VoiceAssistant_main.py (96%) rename {VoiceAssistant => voiceassistant_1}/Project_Basic_struct/dictator.py (96%) rename {VoiceAssistant => voiceassistant_1}/Project_Basic_struct/menu.py (97%) rename {VoiceAssistant => voiceassistant_1}/Project_Basic_struct/speakListen.py (97%) rename {VoiceAssistant => voiceassistant_1}/Project_Basic_struct/speechtotext.py (97%) rename {VoiceAssistant => voiceassistant_1}/Project_Basic_struct/textRead.py (97%) rename {VoiceAssistant => voiceassistant_1}/Project_Basic_struct/websiteWork.py (96%) rename {VoiceAssistant => voiceassistant_1}/README.md (97%) rename {VoiceRepeater => voicerepeater_1}/__main__.py (100%) rename {VoiceRepeater => voicerepeater_1}/readme.md (100%) rename vowel remover function.py => vowel_remover_function.py (100%) rename {Weather Scrapper => weather_scrapper}/weather.csv (99%) rename {Weather Scrapper => weather_scrapper}/weather.py (100%) rename WeatherGUI.py => weathergui_1.py (97%) rename Web_Scraper.py => web_scraper_1.py (100%) rename Web Socket.py => web_socket.py (100%) rename {Webbrowser => webbrowser_1}/tk-browser.py (100%) rename wifi hack by brutefore.py => wifi_hack_by_brutefore.py (100%) rename WikipediaModule.py => wikipediamodule_1.py (100%) rename {Windows_Wallpaper_Script => windows_wallpaper_script_1}/ReadMe.md (100%) rename {Windows_Wallpaper_Script => windows_wallpaper_script_1}/Wallpapers/desktop/89d49683c75888287b50ccb05cab960b991231639dabe5bc817e1d9395a39694.jpg (100%) rename {Windows_Wallpaper_Script => windows_wallpaper_script_1}/Wallpapers/desktop/acc15612b1c85619e06c584a52f6474242963dbb9fe315ec4ecd44de8f3702c8.jpg (100%) rename {Windows_Wallpaper_Script => windows_wallpaper_script_1}/Wallpapers/desktop/c1385a4022859c16bdf317e09668dbb3fc41a7e1c160605539abd1bcd29625af.jpg (100%) rename {Windows_Wallpaper_Script => windows_wallpaper_script_1}/Wallpapers/mobile/5678c6685841ab637cfa63b8c0e32ee205649af2051eb75f40b00f4d5a42b7b9.jpg (100%) rename {Windows_Wallpaper_Script => windows_wallpaper_script_1}/Wallpapers/mobile/a33845e422c7d1b668f60e53e942736c7bbc74299469b7df734254d28e026dc4.jpg (100%) rename {Windows_Wallpaper_Script => windows_wallpaper_script_1}/Wallpapers/mobile/e22f23869f500ee576cdc02fb83f911de31440d589e329d04576e571a54b8851.jpg (100%) rename {Windows_Wallpaper_Script => windows_wallpaper_script_1}/wallpaper_extract.py (100%) rename {Wordle => wordle_1}/5 letter word dictionary.txt (100%) rename {Wordle => wordle_1}/Dictionary.txt (100%) rename {Wordle => wordle_1}/wordle.py (100%) rename {XML => xml_1}/HTML parsing (100%) rename {XORcipher => xorcipher_1}/README.md (100%) rename {XORcipher => xorcipher_1}/XOR_cipher.py (100%) rename {XORcipher => xorcipher_1}/test_XOR_cipher.py (100%) rename {Youtube Downloader With GUI => youtube_downloader_with_gui}/Screenshot (138).png (100%) rename {Youtube Downloader With GUI => youtube_downloader_with_gui}/main.py (100%) rename {Youtube Downloader With GUI => youtube_downloader_with_gui}/photo.jpg (100%) rename {Youtube Downloader With GUI => youtube_downloader_with_gui}/photo.png (100%) rename {Youtube Downloader With GUI => youtube_downloader_with_gui}/youtube-ios-app.ico (100%) diff --git a/1 File handle/File handle binary/Deleting record in a binary file.py b/1_file_handle/File handle binary/Deleting record in a binary file.py similarity index 95% rename from 1 File handle/File handle binary/Deleting record in a binary file.py rename to 1_file_handle/File handle binary/Deleting record in a binary file.py index dca55c2d140..f30e11b2c4c 100644 --- a/1 File handle/File handle binary/Deleting record in a binary file.py +++ b/1_file_handle/File handle binary/Deleting record in a binary file.py @@ -1,21 +1,21 @@ -import pickle - - -def bdelete(): - # Opening a file & loading it - with open("studrec.dat") as F: - stud = pickle.load(F) - print(stud) - - # Deleting the Roll no. entered by user - rno = int(input("Enter the Roll no. to be deleted: ")) - with open("studrec.dat") as F: - rec = [] - for i in stud: - if i[0] == rno: - continue - rec.append(i) - pickle.dump(rec, F) - - -bdelete() +import pickle + + +def bdelete(): + # Opening a file & loading it + with open("studrec.dat") as F: + stud = pickle.load(F) + print(stud) + + # Deleting the Roll no. entered by user + rno = int(input("Enter the Roll no. to be deleted: ")) + with open("studrec.dat") as F: + rec = [] + for i in stud: + if i[0] == rno: + continue + rec.append(i) + pickle.dump(rec, F) + + +bdelete() diff --git a/1 File handle/File handle binary/File handle binary read (record in non list form).py b/1_file_handle/File handle binary/File handle binary read (record in non list form).py similarity index 95% rename from 1 File handle/File handle binary/File handle binary read (record in non list form).py rename to 1_file_handle/File handle binary/File handle binary read (record in non list form).py index f37d97f0bff..0a6b5f5059f 100644 --- a/1 File handle/File handle binary/File handle binary read (record in non list form).py +++ b/1_file_handle/File handle binary/File handle binary read (record in non list form).py @@ -1,23 +1,23 @@ -import pickle - - -def binary_read(): - with open("studrec.dat") as b: - stud = pickle.load(b) - print(stud) - - # prints the whole record in nested list format - print("contents of binary file") - - for ch in stud: - - print(ch) # prints one of the chosen rec in list - - rno = ch[0] - rname = ch[1] # due to unpacking the val not printed in list format - rmark = ch[2] - - print(rno, rname, rmark, end="\t") - - -binary_read() +import pickle + + +def binary_read(): + with open("studrec.dat") as b: + stud = pickle.load(b) + print(stud) + + # prints the whole record in nested list format + print("contents of binary file") + + for ch in stud: + + print(ch) # prints one of the chosen rec in list + + rno = ch[0] + rname = ch[1] # due to unpacking the val not printed in list format + rmark = ch[2] + + print(rno, rname, rmark, end="\t") + + +binary_read() diff --git a/1 File handle/File handle binary/Update a binary file.py b/1_file_handle/File handle binary/Update a binary file.py similarity index 94% rename from 1 File handle/File handle binary/Update a binary file.py rename to 1_file_handle/File handle binary/Update a binary file.py index 19f16b955da..5159f4b9b2f 100644 --- a/1 File handle/File handle binary/Update a binary file.py +++ b/1_file_handle/File handle binary/Update a binary file.py @@ -1,33 +1,33 @@ -# Updating records in a binary file - -import pickle - - -def update(): - F = open("class.dat", "rb+") - S = pickle.load(F) - found = 0 - rno = int(input("enter the roll number you want to update")) - for i in S: - if rno == i[0]: - print("the currrent name is", i[1]) - i[1] = input("enter the new name") - found = 1 - break - - if found == 0: - print("Record not found") - - else: - F.seek(0) - pickle.dump(S, F) - - F.close() - - -update() - -F = open("class.dat", "rb") -val = pickle.load(F) -print(val) -F.close() +# Updating records in a binary file + +import pickle + + +def update(): + F = open("class.dat", "rb+") + S = pickle.load(F) + found = 0 + rno = int(input("enter the roll number you want to update")) + for i in S: + if rno == i[0]: + print("the currrent name is", i[1]) + i[1] = input("enter the new name") + found = 1 + break + + if found == 0: + print("Record not found") + + else: + F.seek(0) + pickle.dump(S, F) + + F.close() + + +update() + +F = open("class.dat", "rb") +val = pickle.load(F) +print(val) +F.close() diff --git a/1 File handle/File handle binary/Update a binary file2.py b/1_file_handle/File handle binary/Update a binary file2.py similarity index 95% rename from 1 File handle/File handle binary/Update a binary file2.py rename to 1_file_handle/File handle binary/Update a binary file2.py index 38925dc6332..69d66dda0f6 100644 --- a/1 File handle/File handle binary/Update a binary file2.py +++ b/1_file_handle/File handle binary/Update a binary file2.py @@ -1,31 +1,31 @@ -# updating records in a bnary file - -import pickle - - -def update(): - File = open("studrec.dat", "rb+") - value = pickle.load(File) - found = 0 - roll = int(input("Enter the roll number of the record")) - for i in value: - if roll == i[0]: - print("current name", i[1]) - print("current marks", i[2]) - i[1] = input("Enter the new name") - i[2] = int(input("Enter the new marks")) - found = 1 - - if found == 0: - print("Record not found") - - else: - pickle.dump(value, File) - File.seek(0) - newval = pickle.load(File) - print(newval) - - File.close() - - -update() +# updating records in a bnary file + +import pickle + + +def update(): + File = open("studrec.dat", "rb+") + value = pickle.load(File) + found = 0 + roll = int(input("Enter the roll number of the record")) + for i in value: + if roll == i[0]: + print("current name", i[1]) + print("current marks", i[2]) + i[1] = input("Enter the new name") + i[2] = int(input("Enter the new marks")) + found = 1 + + if found == 0: + print("Record not found") + + else: + pickle.dump(value, File) + File.seek(0) + newval = pickle.load(File) + print(newval) + + File.close() + + +update() diff --git a/1 File handle/File handle binary/class.dat b/1_file_handle/File handle binary/class.dat similarity index 100% rename from 1 File handle/File handle binary/class.dat rename to 1_file_handle/File handle binary/class.dat diff --git a/1 File handle/File handle binary/question 1 (elegible for remedial, top marks).py b/1_file_handle/File handle binary/question 1 (elegible for remedial, top marks).py similarity index 95% rename from 1 File handle/File handle binary/question 1 (elegible for remedial, top marks).py rename to 1_file_handle/File handle binary/question 1 (elegible for remedial, top marks).py index 08ac16f3e32..4c5c24eec5f 100644 --- a/1 File handle/File handle binary/question 1 (elegible for remedial, top marks).py +++ b/1_file_handle/File handle binary/question 1 (elegible for remedial, top marks).py @@ -1,77 +1,77 @@ -"""Amit is a monitor of class XII-A and he stored the record of all -the students of his class in a file named “class.datâ€. -Structure of record is [roll number, name, percentage]. His computer -teacher has assigned the following duty to Amit - -Write a function remcount( ) to count the number of students who need - remedial class (student who scored less than 40 percent) - - - """ -# also find no. of children who got top marks - -import pickle - -F = open("class.dat", "ab") -list = [ - [1, "Ramya", 30], - [2, "vaishnavi", 60], - [3, "anuya", 40], - [4, "kamala", 30], - [5, "anuraag", 10], - [6, "Reshi", 77], - [7, "Biancaa.R", 100], - [8, "sandhya", 65], -] - - -pickle.dump(list, F) -F.close() - - -def remcount(): - F = open("class.dat", "rb") - val = pickle.load(F) - count = 0 - - for i in val: - if i[2] <= 40: - print(i, "eligible for remedial") - count += 1 - print("the total number of students are", count) - F.close() - - -remcount() - - -def firstmark(): - F = open("class.dat", "rb") - val = pickle.load(F) - main = [] - count = 0 - - for i in val: - data = i[2] - main.append(data) - - top = max(main) - print(top, "is the first mark") - - F.seek(0) - for i in val: - if top == i[2]: - print(i) - print("congrats") - count += 1 - - print("the total number of students who secured top marks are", count) - F.close() - - -firstmark() - -F = open("class.dat", "rb") -val = pickle.load(F) -print(val) -F.close() +"""Amit is a monitor of class XII-A and he stored the record of all +the students of his class in a file named “class.datâ€. +Structure of record is [roll number, name, percentage]. His computer +teacher has assigned the following duty to Amit + +Write a function remcount( ) to count the number of students who need + remedial class (student who scored less than 40 percent) + + + """ +# also find no. of children who got top marks + +import pickle + +F = open("class.dat", "ab") +list = [ + [1, "Ramya", 30], + [2, "vaishnavi", 60], + [3, "anuya", 40], + [4, "kamala", 30], + [5, "anuraag", 10], + [6, "Reshi", 77], + [7, "Biancaa.R", 100], + [8, "sandhya", 65], +] + + +pickle.dump(list, F) +F.close() + + +def remcount(): + F = open("class.dat", "rb") + val = pickle.load(F) + count = 0 + + for i in val: + if i[2] <= 40: + print(i, "eligible for remedial") + count += 1 + print("the total number of students are", count) + F.close() + + +remcount() + + +def firstmark(): + F = open("class.dat", "rb") + val = pickle.load(F) + main = [] + count = 0 + + for i in val: + data = i[2] + main.append(data) + + top = max(main) + print(top, "is the first mark") + + F.seek(0) + for i in val: + if top == i[2]: + print(i) + print("congrats") + count += 1 + + print("the total number of students who secured top marks are", count) + F.close() + + +firstmark() + +F = open("class.dat", "rb") +val = pickle.load(F) +print(val) +F.close() diff --git a/1 File handle/File handle binary/search record in binary file.py b/1_file_handle/File handle binary/search record in binary file.py similarity index 95% rename from 1 File handle/File handle binary/search record in binary file.py rename to 1_file_handle/File handle binary/search record in binary file.py index fd58d246bb9..a0b96be60af 100644 --- a/1 File handle/File handle binary/search record in binary file.py +++ b/1_file_handle/File handle binary/search record in binary file.py @@ -1,24 +1,24 @@ -# binary file to search a given record - -import pickle - - -def binary_search(): - F = open("studrec.dat", "rb") - # your file path will be different - value = pickle.load(F) - search = 0 - rno = int(input("Enter the roll number of the student")) - - for i in value: - if i[0] == rno: - print("Record found successfully") - print(i) - search = 1 - - if search == 0: - print("Sorry! record not found") - F.close() - - -binary_search() +# binary file to search a given record + +import pickle + + +def binary_search(): + F = open("studrec.dat", "rb") + # your file path will be different + value = pickle.load(F) + search = 0 + rno = int(input("Enter the roll number of the student")) + + for i in value: + if i[0] == rno: + print("Record found successfully") + print(i) + search = 1 + + if search == 0: + print("Sorry! record not found") + F.close() + + +binary_search() diff --git a/1 File handle/File handle binary/studrec.dat b/1_file_handle/File handle binary/studrec.dat similarity index 100% rename from 1 File handle/File handle binary/studrec.dat rename to 1_file_handle/File handle binary/studrec.dat diff --git a/1 File handle/File handle text/file handle 12 length of line in text file.py b/1_file_handle/File handle text/file handle 12 length of line in text file.py similarity index 96% rename from 1 File handle/File handle text/file handle 12 length of line in text file.py rename to 1_file_handle/File handle text/file handle 12 length of line in text file.py index 7666668310d..70ee02cb8b9 100644 --- a/1 File handle/File handle text/file handle 12 length of line in text file.py +++ b/1_file_handle/File handle text/file handle 12 length of line in text file.py @@ -1,38 +1,38 @@ - -import os -import time -file_name= input("Enter the file name to create:- ") - -print(file_name) - -def write_to_file(file_name): - - if os.path.exists(file_name): - print(f"Error: {file_name} already exists.") - - else: - with open(file_name, "a") as F: - while True: - text = input("enter any text to add in the file:- ") - F.write( - text + "\n" - ) # write function takes exactly 1 arguement so concatenation - choice = input("Do you want to enter more, y/n") - if choice == "n": - break - -def longlines(): - with open(file_name, encoding='utf-8') as F: - lines = F.readlines() - - for i in lines: - if len(i) < 50: - print(i, end="\t") - else: - print("There is no line which is less than 50 ") - - -if __name__ == "__main__": - write_to_file(file_name) - time.sleep(1) + +import os +import time +file_name= input("Enter the file name to create:- ") + +print(file_name) + +def write_to_file(file_name): + + if os.path.exists(file_name): + print(f"Error: {file_name} already exists.") + + else: + with open(file_name, "a") as F: + while True: + text = input("enter any text to add in the file:- ") + F.write( + text + "\n" + ) # write function takes exactly 1 arguement so concatenation + choice = input("Do you want to enter more, y/n") + if choice == "n": + break + +def longlines(): + with open(file_name, encoding='utf-8') as F: + lines = F.readlines() + + for i in lines: + if len(i) < 50: + print(i, end="\t") + else: + print("There is no line which is less than 50 ") + + +if __name__ == "__main__": + write_to_file(file_name) + time.sleep(1) longlines() \ No newline at end of file diff --git a/1 File handle/File handle text/happy.txt b/1_file_handle/File handle text/happy.txt similarity index 96% rename from 1 File handle/File handle text/happy.txt rename to 1_file_handle/File handle text/happy.txt index c5ca39434bb..ce9edea82d1 100644 --- a/1 File handle/File handle text/happy.txt +++ b/1_file_handle/File handle text/happy.txt @@ -1,11 +1,11 @@ -hello how are you -what is your name -do not worry everything is alright -everything will be alright -please don't lose hope -Wonders are on the way -Take a walk in the park -At the end of the day you are more important than anything else. -Many moments of happiness are waiting -You are amazing! +hello how are you +what is your name +do not worry everything is alright +everything will be alright +please don't lose hope +Wonders are on the way +Take a walk in the park +At the end of the day you are more important than anything else. +Many moments of happiness are waiting +You are amazing! If you truly believe. \ No newline at end of file diff --git a/1 File handle/File handle text/input,output and error streams.py b/1_file_handle/File handle text/input,output and error streams.py similarity index 96% rename from 1 File handle/File handle text/input,output and error streams.py rename to 1_file_handle/File handle text/input,output and error streams.py index cecd268979b..0a4f1e0ccca 100644 --- a/1 File handle/File handle text/input,output and error streams.py +++ b/1_file_handle/File handle text/input,output and error streams.py @@ -1,16 +1,16 @@ -# practicing with streams -import sys - -sys.stdout.write("Enter the name of the file") -file = sys.stdin.readline() - -with open(file.strip(), ) as F: - - while True: - ch = F.readlines() - 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 - print(i, end="") - else: - sys.stderr.write("End of file reached") - break - +# practicing with streams +import sys + +sys.stdout.write("Enter the name of the file") +file = sys.stdin.readline() + +with open(file.strip(), ) as F: + + while True: + ch = F.readlines() + 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 + print(i, end="") + else: + sys.stderr.write("End of file reached") + break + diff --git a/1 File handle/File handle text/question 2.py b/1_file_handle/File handle text/question 2.py similarity index 96% rename from 1 File handle/File handle text/question 2.py rename to 1_file_handle/File handle text/question 2.py index c5f49454b2e..1f9b63d2795 100644 --- a/1 File handle/File handle text/question 2.py +++ b/1_file_handle/File handle text/question 2.py @@ -1,37 +1,37 @@ -""" Write a method/function DISPLAYWORDS() in python to read lines - from a text file STORY.TXT, - using read function -and display those words, which are less than 4 characters. """ - - -print("Hey!! You can print the word which are less then 4 characters") - -def display_words(file_path): - - - try: - with open(file_path, 'r') as F: - lines = F.read() - words = lines.split() - count = 0 - for word in words: - if (len(word) < 4): - print(word) - count += 1 - return "The total number of the word's count which has less than 4 characters", (count) - - except FileNotFoundError: - print("File not found") - -print("Just need to pass the path of your file..") - -file_path = input("Please, Enter file path: ") - -if __name__ == "__main__": - - print(display_words(file_path)) - - - - - +""" Write a method/function DISPLAYWORDS() in python to read lines + from a text file STORY.TXT, + using read function +and display those words, which are less than 4 characters. """ + + +print("Hey!! You can print the word which are less then 4 characters") + +def display_words(file_path): + + + try: + with open(file_path, 'r') as F: + lines = F.read() + words = lines.split() + count = 0 + for word in words: + if (len(word) < 4): + print(word) + count += 1 + return "The total number of the word's count which has less than 4 characters", (count) + + except FileNotFoundError: + print("File not found") + +print("Just need to pass the path of your file..") + +file_path = input("Please, Enter file path: ") + +if __name__ == "__main__": + + print(display_words(file_path)) + + + + + diff --git a/1 File handle/File handle text/question 5.py b/1_file_handle/File handle text/question 5.py similarity index 96% rename from 1 File handle/File handle text/question 5.py rename to 1_file_handle/File handle text/question 5.py index 795433266aa..d5116d1b021 100644 --- a/1 File handle/File handle text/question 5.py +++ b/1_file_handle/File handle text/question 5.py @@ -1,52 +1,52 @@ -"""Write a function in python to count the number of lowercase -alphabets present in a text file “happy.txt""" - -import time -import os - -print("You will see the count of lowercase, uppercase and total count of alphabets in provided file..") - - -file_path = input("Please, Enter file path: ") - -if os.path.exists(file_path): - print('The file exists and this is the path:\n',file_path) - - -def lowercase(file_path): - try: - - with open(file_path, 'r') as F: - # Define the initial count of the lower and upper case. - lowercase_count = 0 - uppercase_count = 0 - - value = F.read() - - for i in value: - if i.islower(): - # It will increase the count. - lowercase_count += 1 - elif i.isupper(): - uppercase_count += 1 - - - - total_count = lowercase_count+uppercase_count - - print("The total number of lower case letters are", lowercase_count) - time.sleep(1) - print("The total number of upper case letters are", uppercase_count) - time.sleep(1) - print("The total number of letters are", total_count) - time.sleep(1) - - except FileNotFoundError: - print("File is not exist.. Please check AGAIN") - - - - -if __name__ == "__main__": - - lowercase(file_path) +"""Write a function in python to count the number of lowercase +alphabets present in a text file “happy.txt""" + +import time +import os + +print("You will see the count of lowercase, uppercase and total count of alphabets in provided file..") + + +file_path = input("Please, Enter file path: ") + +if os.path.exists(file_path): + print('The file exists and this is the path:\n',file_path) + + +def lowercase(file_path): + try: + + with open(file_path, 'r') as F: + # Define the initial count of the lower and upper case. + lowercase_count = 0 + uppercase_count = 0 + + value = F.read() + + for i in value: + if i.islower(): + # It will increase the count. + lowercase_count += 1 + elif i.isupper(): + uppercase_count += 1 + + + + total_count = lowercase_count+uppercase_count + + print("The total number of lower case letters are", lowercase_count) + time.sleep(1) + print("The total number of upper case letters are", uppercase_count) + time.sleep(1) + print("The total number of letters are", total_count) + time.sleep(1) + + except FileNotFoundError: + print("File is not exist.. Please check AGAIN") + + + + +if __name__ == "__main__": + + lowercase(file_path) diff --git a/1 File handle/File handle text/question 6.py b/1_file_handle/File handle text/question 6.py similarity index 97% rename from 1 File handle/File handle text/question 6.py rename to 1_file_handle/File handle text/question 6.py index b41373135cf..d0adadca3dd 100644 --- a/1 File handle/File handle text/question 6.py +++ b/1_file_handle/File handle text/question 6.py @@ -1,20 +1,20 @@ -"""Write a function in python to count the number of lowercase -alphabets present in a text file “happy.txt""" - - -def lowercase(): - with open("happy.txt") as F: - count_lower = 0 - count_upper = 0 - value = F.read() - for i in value: - if i.islower(): - count_lower += 1 - elif i.isupper(): - count_upper += 1 - print("The total number of lower case letters are", count_lower) - print("The total number of upper case letters are", count_upper) - print("The total number of letters are", count_lower + count_upper) - -if __name__ == "__main__": - lowercase() +"""Write a function in python to count the number of lowercase +alphabets present in a text file “happy.txt""" + + +def lowercase(): + with open("happy.txt") as F: + count_lower = 0 + count_upper = 0 + value = F.read() + for i in value: + if i.islower(): + count_lower += 1 + elif i.isupper(): + count_upper += 1 + print("The total number of lower case letters are", count_lower) + print("The total number of upper case letters are", count_upper) + print("The total number of letters are", count_lower + count_upper) + +if __name__ == "__main__": + lowercase() diff --git a/1 File handle/File handle text/question3.py b/1_file_handle/File handle text/question3.py similarity index 96% rename from 1 File handle/File handle text/question3.py rename to 1_file_handle/File handle text/question3.py index 713dc7f917a..1aa59d2b47c 100644 --- a/1 File handle/File handle text/question3.py +++ b/1_file_handle/File handle text/question3.py @@ -1,48 +1,48 @@ -"""Write a user-defined function named count() that will read -the contents of text file named “happy.txt†and count -the number of lines which starts with either “I‟ or “M‟.""" - -import os -import time -file_name= input("Enter the file name to create:- ") - -# step1: -print(file_name) - - - -def write_to_file(file_name): - - if os.path.exists(file_name): - print(f"Error: {file_name} already exists.") - - else: - with open(file_name, "a") as F: - while True: - text = input("enter any text") - F.write( - text + "\n" - ) # write function takes exactly 1 arguement so concatenation - choice = input("do you want to enter more, y/n") - if choice == "n": - break - -# write_to_file() - -# step2: -def check_first_letter(): - with open(file_name) as F: - value = F.read() - count = 0 - line = value.split() - for i in line: - if i[0] in ["m", "M", "i", "I"]: - count += 1 - print(i) - print("The total number of sentences starting with I or M are", count) - -if __name__ == "__main__": - - write_to_file(file_name) - time.sleep(1) - check_first_letter() +"""Write a user-defined function named count() that will read +the contents of text file named “happy.txt†and count +the number of lines which starts with either “I‟ or “M‟.""" + +import os +import time +file_name= input("Enter the file name to create:- ") + +# step1: +print(file_name) + + + +def write_to_file(file_name): + + if os.path.exists(file_name): + print(f"Error: {file_name} already exists.") + + else: + with open(file_name, "a") as F: + while True: + text = input("enter any text") + F.write( + text + "\n" + ) # write function takes exactly 1 arguement so concatenation + choice = input("do you want to enter more, y/n") + if choice == "n": + break + +# write_to_file() + +# step2: +def check_first_letter(): + with open(file_name) as F: + value = F.read() + count = 0 + line = value.split() + for i in line: + if i[0] in ["m", "M", "i", "I"]: + count += 1 + print(i) + print("The total number of sentences starting with I or M are", count) + +if __name__ == "__main__": + + write_to_file(file_name) + time.sleep(1) + check_first_letter() diff --git a/1 File handle/File handle text/special symbol after word.py b/1_file_handle/File handle text/special symbol after word.py similarity index 94% rename from 1 File handle/File handle text/special symbol after word.py rename to 1_file_handle/File handle text/special symbol after word.py index 353a98cca87..4e82efddc27 100644 --- a/1 File handle/File handle text/special symbol after word.py +++ b/1_file_handle/File handle text/special symbol after word.py @@ -1,16 +1,16 @@ -F = open("happy.txt", "r") -# method 1 -val = F.read() -val = val.split() -for i in val: - print(i, "*", end="") -print("\n") - - -# method 2 -F.seek(0) -value = F.readlines() -for line in value: - for word in line.split(): - print(word, "*", end="") -F.close() +F = open("happy.txt", "r") +# method 1 +val = F.read() +val = val.split() +for i in val: + print(i, "*", end="") +print("\n") + + +# method 2 +F.seek(0) +value = F.readlines() +for line in value: + for word in line.split(): + print(word, "*", end="") +F.close() diff --git a/1 File handle/File handle text/story.txt b/1_file_handle/File handle text/story.txt similarity index 97% rename from 1 File handle/File handle text/story.txt rename to 1_file_handle/File handle text/story.txt index eb78dae4be8..c9f59eb01c6 100644 --- a/1 File handle/File handle text/story.txt +++ b/1_file_handle/File handle text/story.txt @@ -1,5 +1,5 @@ -once upon a time there was a king. -he was powerful and happy. -he -all the flowers in his garden were beautiful. +once upon a time there was a king. +he was powerful and happy. +he +all the flowers in his garden were beautiful. he lived happily ever after. \ No newline at end of file diff --git a/A solution to project euler problem 3.py b/a_solution_to_project_euler_problem_3.py similarity index 100% rename from A solution to project euler problem 3.py rename to a_solution_to_project_euler_problem_3.py diff --git a/add 2 number.py b/add_2_number.py similarity index 100% rename from add 2 number.py rename to add_2_number.py diff --git a/add 2 numbers.py b/add_2_numbers.py similarity index 100% rename from add 2 numbers.py rename to add_2_numbers.py diff --git a/Add_two_Linked_List.py b/add_two_linked_list_1.py similarity index 96% rename from Add_two_Linked_List.py rename to add_two_linked_list_1.py index 97d10a1011b..10583bfc8d8 100644 --- a/Add_two_Linked_List.py +++ b/add_two_linked_list_1.py @@ -1,68 +1,68 @@ -class Node: - def __init__(self, data): - self.data = data - self.next = None - - -class LinkedList: - def __init__(self): - self.head = None - - def insert_at_beginning(self, new_data): - new_node = Node(new_data) - if self.head is None: - self.head = new_node - return - new_node.next = self.head - self.head = new_node - - def add_two_no(self, first, second): - prev = None - temp = None - carry = 0 - while first is not None or second is not None: - first_data = 0 if first is None else first.data - second_data = 0 if second is None else second.data - Sum = carry + first_data + second_data - carry = 1 if Sum >= 10 else 0 - Sum = Sum if Sum < 10 else Sum % 10 - temp = Node(Sum) - if self.head is None: - self.head = temp - else: - prev.next = temp - prev = temp - if first is not None: - first = first.next - if second is not None: - second = second.next - if carry > 0: - temp.next = Node(carry) - - def __str__(self): - temp = self.head - while temp: - print(temp.data, "->", end=" ") - temp = temp.next - return "None" - - -if __name__ == "__main__": - first = LinkedList() - second = LinkedList() - first.insert_at_beginning(6) - first.insert_at_beginning(4) - first.insert_at_beginning(9) - - second.insert_at_beginning(2) - second.insert_at_beginning(2) - - print("First Linked List: ") - print(first) - print("Second Linked List: ") - print(second) - - result = LinkedList() - result.add_two_no(first.head, second.head) - print("Final Result: ") - print(result) +class Node: + def __init__(self, data): + self.data = data + self.next = None + + +class LinkedList: + def __init__(self): + self.head = None + + def insert_at_beginning(self, new_data): + new_node = Node(new_data) + if self.head is None: + self.head = new_node + return + new_node.next = self.head + self.head = new_node + + def add_two_no(self, first, second): + prev = None + temp = None + carry = 0 + while first is not None or second is not None: + first_data = 0 if first is None else first.data + second_data = 0 if second is None else second.data + Sum = carry + first_data + second_data + carry = 1 if Sum >= 10 else 0 + Sum = Sum if Sum < 10 else Sum % 10 + temp = Node(Sum) + if self.head is None: + self.head = temp + else: + prev.next = temp + prev = temp + if first is not None: + first = first.next + if second is not None: + second = second.next + if carry > 0: + temp.next = Node(carry) + + def __str__(self): + temp = self.head + while temp: + print(temp.data, "->", end=" ") + temp = temp.next + return "None" + + +if __name__ == "__main__": + first = LinkedList() + second = LinkedList() + first.insert_at_beginning(6) + first.insert_at_beginning(4) + first.insert_at_beginning(9) + + second.insert_at_beginning(2) + second.insert_at_beginning(2) + + print("First Linked List: ") + print(first) + print("Second Linked List: ") + print(second) + + result = LinkedList() + result.add_two_no(first.head, second.head) + print("Final Result: ") + print(result) diff --git a/add two no.py b/add_two_no.py similarity index 100% rename from add two no.py rename to add_two_no.py diff --git a/add two number.py b/add_two_number.py similarity index 100% rename from add two number.py rename to add_two_number.py diff --git a/Add two numbers.py b/add_two_numbers.py similarity index 100% rename from Add two numbers.py rename to add_two_numbers.py diff --git a/Addtion of two numbers.py b/addtion_of_two_numbers.py similarity index 100% rename from Addtion of two numbers.py rename to addtion_of_two_numbers.py diff --git a/AREA OF TRIANGLE.py b/area_of_triangle.py similarity index 100% rename from AREA OF TRIANGLE.py rename to area_of_triangle.py diff --git a/AreaOfTriangle.py b/areaoftriangle_1.py similarity index 100% rename from AreaOfTriangle.py rename to areaoftriangle_1.py diff --git a/ARKA.py b/arka_1.py similarity index 100% rename from ARKA.py rename to arka_1.py diff --git a/Armstrong_number b/armstrong_number_1 similarity index 100% rename from Armstrong_number rename to armstrong_number_1 diff --git a/Armstrong_number.py b/armstrong_number_1.py similarity index 95% rename from Armstrong_number.py rename to armstrong_number_1.py index be923c0bf35..f76e348af70 100644 --- a/Armstrong_number.py +++ b/armstrong_number_1.py @@ -1,21 +1,21 @@ -def is_armstrong_number(number): - total = 0 - - # find the sum of the cube of each digit - temp = number - while temp > 0: - digit = temp % 10 - total += digit ** 3 - temp //= 10 - - # return the result - if number == total: - return True - else: - return False - -number = int(input("Enter the number: ")) -if is_armstrong_number(number): - print(number,"is an Armstrong number") -else: - print(number,"is not an Armstrong number") +def is_armstrong_number(number): + total = 0 + + # find the sum of the cube of each digit + temp = number + while temp > 0: + digit = temp % 10 + total += digit ** 3 + temp //= 10 + + # return the result + if number == total: + return True + else: + return False + +number = int(input("Enter the number: ")) +if is_armstrong_number(number): + print(number,"is an Armstrong number") +else: + print(number,"is not an Armstrong number") diff --git a/ASCIIvaluecharacter.py b/asciivaluecharacter_1.py similarity index 100% rename from ASCIIvaluecharacter.py rename to asciivaluecharacter_1.py diff --git a/Assembler/GUIDE.txt b/assembler_1/GUIDE.txt similarity index 100% rename from Assembler/GUIDE.txt rename to assembler_1/GUIDE.txt diff --git a/Assembler/README.md b/assembler_1/README.md similarity index 100% rename from Assembler/README.md rename to assembler_1/README.md diff --git a/Assembler/assembler.py b/assembler_1/assembler.py similarity index 100% rename from Assembler/assembler.py rename to assembler_1/assembler.py diff --git a/Assembler/examples/code.txt b/assembler_1/examples/code.txt similarity index 100% rename from Assembler/examples/code.txt rename to assembler_1/examples/code.txt diff --git a/Assembler/examples/code2.txt b/assembler_1/examples/code2.txt similarity index 100% rename from Assembler/examples/code2.txt rename to assembler_1/examples/code2.txt diff --git a/Assembler/examples/code3.txt b/assembler_1/examples/code3.txt similarity index 100% rename from Assembler/examples/code3.txt rename to assembler_1/examples/code3.txt diff --git a/Assembler/examples/code4.txt b/assembler_1/examples/code4.txt similarity index 100% rename from Assembler/examples/code4.txt rename to assembler_1/examples/code4.txt diff --git a/Assembler/examples/test.txt b/assembler_1/examples/test.txt similarity index 100% rename from Assembler/examples/test.txt rename to assembler_1/examples/test.txt diff --git a/Assembler/requirements.txt b/assembler_1/requirements.txt similarity index 100% rename from Assembler/requirements.txt rename to assembler_1/requirements.txt diff --git a/Automated Scheduled Call Reminders/caller.py b/automated_scheduled_call_reminders/caller.py similarity index 100% rename from Automated Scheduled Call Reminders/caller.py rename to automated_scheduled_call_reminders/caller.py diff --git a/Automated Scheduled Call Reminders/requirements.txt b/automated_scheduled_call_reminders/requirements.txt similarity index 100% rename from Automated Scheduled Call Reminders/requirements.txt rename to automated_scheduled_call_reminders/requirements.txt diff --git a/Automated Scheduled Call Reminders/schedular.py b/automated_scheduled_call_reminders/schedular.py similarity index 100% rename from Automated Scheduled Call Reminders/schedular.py rename to automated_scheduled_call_reminders/schedular.py diff --git a/Bank Application .ipynb b/bank_application_.ipynb similarity index 100% rename from Bank Application .ipynb rename to bank_application_.ipynb diff --git a/Base Converter Number system.py b/base_converter_number_system.py similarity index 100% rename from Base Converter Number system.py rename to base_converter_number_system.py diff --git a/basic example b/basic_example similarity index 100% rename from basic example rename to basic_example diff --git a/Battery_notifier.py b/battery_notifier_1.py similarity index 100% rename from Battery_notifier.py rename to battery_notifier_1.py diff --git a/Binary Coefficients.py b/binary_coefficients.py similarity index 100% rename from Binary Coefficients.py rename to binary_coefficients.py diff --git a/binary search.py b/binary_search_1.py similarity index 100% rename from binary search.py rename to binary_search_1.py diff --git a/Binary_search.py b/binary_search_2.py similarity index 100% rename from Binary_search.py rename to binary_search_2.py diff --git a/Binary_to_Decimal.py b/binary_to_decimal_1.py similarity index 100% rename from Binary_to_Decimal.py rename to binary_to_decimal_1.py diff --git a/binarySTree isTrue_YashV1729.Java b/binarystree_istrue_yashv1729.java similarity index 100% rename from binarySTree isTrue_YashV1729.Java rename to binarystree_istrue_yashv1729.java diff --git a/BlackJack_game/blackjack.py b/blackjack_game_1/blackjack.py similarity index 100% rename from BlackJack_game/blackjack.py rename to blackjack_game_1/blackjack.py diff --git a/BlackJack_game/blackjack_rr.py b/blackjack_game_1/blackjack_rr.py similarity index 100% rename from BlackJack_game/blackjack_rr.py rename to blackjack_game_1/blackjack_rr.py diff --git a/BlackJack_game/blackjack_simulate.py b/blackjack_game_1/blackjack_simulate.py similarity index 100% rename from BlackJack_game/blackjack_simulate.py rename to blackjack_game_1/blackjack_simulate.py diff --git a/BlackJack_game/requirements.txt b/blackjack_game_1/requirements.txt similarity index 100% rename from BlackJack_game/requirements.txt rename to blackjack_game_1/requirements.txt diff --git a/blackJackGUI.py b/blackjackgui_1.py similarity index 96% rename from blackJackGUI.py rename to blackjackgui_1.py index a67e6e06717..1d74c9f9335 100644 --- a/blackJackGUI.py +++ b/blackjackgui_1.py @@ -1,181 +1,181 @@ -from __future__ import print_function -import random -import simplegui - -CARD_SIZE = (72, 96) -CARD_CENTER = (36, 48) -card_images = simplegui.load_image( - "http://storage.googleapis.com/codeskulptor-assets/cards_jfitz.png" -) - -in_play = False -outcome = "" -score = 0 - -SUITS = ("C", "S", "H", "D") -RANKS = ("A", "2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K") -VALUES = { - "A": 1, - "2": 2, - "3": 3, - "4": 4, - "5": 5, - "6": 6, - "7": 7, - "8": 8, - "9": 9, - "T": 10, - "J": 10, - "Q": 10, - "K": 10, -} - - -class Card: - def __init__(self, suit, rank): - if (suit in SUITS) and (rank in RANKS): - self.suit = suit - self.rank = rank - else: - self.suit = None - self.rank = None - print(("Invalid card: ", suit, rank)) - - def __str__(self): - return self.suit + self.rank - - def get_suit(self): - return self.suit - - def get_rank(self): - return self.rank - - def draw(self, canvas, pos): - card_loc = ( - CARD_CENTER[0] + CARD_SIZE[0] * RANKS.index(self.rank), - CARD_CENTER[1] + CARD_SIZE[1] * SUITS.index(self.suit), - ) - canvas.draw_image( - card_images, - card_loc, - CARD_SIZE, - [pos[0] + CARD_CENTER[0], pos[1] + CARD_CENTER[1]], - CARD_SIZE, - ) - - -def string_list_join(string, string_list): - ans = string + " contains " - for i in range(len(string_list)): - ans += str(string_list[i]) + " " - return ans - - -class Hand: - def __init__(self): - self.hand = [] - - def __str__(self): - return string_list_join("Hand", self.hand) - - def add_card(self, card): - self.hand.append(card) - - def get_value(self): - var = [] - self.hand_value = 0 - for card in self.hand: - card = str(card) - if card[1] in VALUES: - self.hand_value += VALUES[card[1]] - var.append(card[1]) - if "A" not in var: - return self.hand_value - if self.hand_value + 10 <= 21: - return self.hand_value + 10 - else: - return self.hand_value - - def draw(self, canvas, pos): - for card in self.hand: - card = str(card) - Card(card[0], card[1]).draw(canvas, pos) - pos[0] += 36 - - -class Deck: - def __init__(self): - self.Deck = [Card(suit, rank) for suit in SUITS for rank in RANKS] - - def shuffle(self): - random.shuffle(self.Deck) - - def deal_card(self): - return random.choice(self.Deck) - - def __str__(self): - return string_list_join("Deck", self.Deck) - - -def deal(): - global outcome, in_play, score1, score2, player_card, dealer_card, deck - outcome = "" - player_card = Hand() - dealer_card = Hand() - deck = Deck() - for i in range(2): - player_card.add_card(deck.deal_card()) - dealer_card.add_card(deck.deal_card()) - - in_play = True - score1 = str(player_card.get_value()) - score2 = str(dealer_card.get_value()) - - -def stand(): - if in_play == True: - while dealer_card.get_value() < 17: - dealer_card.add_card(deck.deal_card()) - if dealer_card.get_value() > 21: - outcome = "you won!!" - elif player_card.get_value() <= dealer_card.get_value(): - outcome = "you lose" - else: - outcome = "you won!!" - score1 = str(player_card.get_value()) - score2 = str(dealer_card.get_value()) - - -def hit(): - global outcome, in_play, score1, score2, player_card, dealer_card, deck - if in_play == True: - player_card.add_card(deck.deal_card()) - - if player_card.get_value() > 21: - outcome = "you are busted" - in_play = False - - score1 = str(player_card.get_value()) - score2 = str(dealer_card.get_value()) - - -def draw(canvas): - canvas.draw_text(outcome, [250, 150], 25, "White") - canvas.draw_text("BlackJack", [250, 50], 40, "Black") - canvas.draw_text(score1, [100, 100], 40, "Red") - - player_card.draw(canvas, [20, 300]) - dealer_card.draw(canvas, [300, 300]) - canvas.draw_text(score2, [400, 100], 40, "Red") - - -frame = simplegui.create_frame("Blackjack", 600, 600) -frame.set_canvas_background("Green") - -frame.add_button("Deal", deal, 200) -frame.add_button("Hit", hit, 200) -frame.add_button("Stand", stand, 200) -frame.set_draw_handler(draw) - -deal() -frame.start() +from __future__ import print_function +import random +import simplegui + +CARD_SIZE = (72, 96) +CARD_CENTER = (36, 48) +card_images = simplegui.load_image( + "http://storage.googleapis.com/codeskulptor-assets/cards_jfitz.png" +) + +in_play = False +outcome = "" +score = 0 + +SUITS = ("C", "S", "H", "D") +RANKS = ("A", "2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K") +VALUES = { + "A": 1, + "2": 2, + "3": 3, + "4": 4, + "5": 5, + "6": 6, + "7": 7, + "8": 8, + "9": 9, + "T": 10, + "J": 10, + "Q": 10, + "K": 10, +} + + +class Card: + def __init__(self, suit, rank): + if (suit in SUITS) and (rank in RANKS): + self.suit = suit + self.rank = rank + else: + self.suit = None + self.rank = None + print(("Invalid card: ", suit, rank)) + + def __str__(self): + return self.suit + self.rank + + def get_suit(self): + return self.suit + + def get_rank(self): + return self.rank + + def draw(self, canvas, pos): + card_loc = ( + CARD_CENTER[0] + CARD_SIZE[0] * RANKS.index(self.rank), + CARD_CENTER[1] + CARD_SIZE[1] * SUITS.index(self.suit), + ) + canvas.draw_image( + card_images, + card_loc, + CARD_SIZE, + [pos[0] + CARD_CENTER[0], pos[1] + CARD_CENTER[1]], + CARD_SIZE, + ) + + +def string_list_join(string, string_list): + ans = string + " contains " + for i in range(len(string_list)): + ans += str(string_list[i]) + " " + return ans + + +class Hand: + def __init__(self): + self.hand = [] + + def __str__(self): + return string_list_join("Hand", self.hand) + + def add_card(self, card): + self.hand.append(card) + + def get_value(self): + var = [] + self.hand_value = 0 + for card in self.hand: + card = str(card) + if card[1] in VALUES: + self.hand_value += VALUES[card[1]] + var.append(card[1]) + if "A" not in var: + return self.hand_value + if self.hand_value + 10 <= 21: + return self.hand_value + 10 + else: + return self.hand_value + + def draw(self, canvas, pos): + for card in self.hand: + card = str(card) + Card(card[0], card[1]).draw(canvas, pos) + pos[0] += 36 + + +class Deck: + def __init__(self): + self.Deck = [Card(suit, rank) for suit in SUITS for rank in RANKS] + + def shuffle(self): + random.shuffle(self.Deck) + + def deal_card(self): + return random.choice(self.Deck) + + def __str__(self): + return string_list_join("Deck", self.Deck) + + +def deal(): + global outcome, in_play, score1, score2, player_card, dealer_card, deck + outcome = "" + player_card = Hand() + dealer_card = Hand() + deck = Deck() + for i in range(2): + player_card.add_card(deck.deal_card()) + dealer_card.add_card(deck.deal_card()) + + in_play = True + score1 = str(player_card.get_value()) + score2 = str(dealer_card.get_value()) + + +def stand(): + if in_play == True: + while dealer_card.get_value() < 17: + dealer_card.add_card(deck.deal_card()) + if dealer_card.get_value() > 21: + outcome = "you won!!" + elif player_card.get_value() <= dealer_card.get_value(): + outcome = "you lose" + else: + outcome = "you won!!" + score1 = str(player_card.get_value()) + score2 = str(dealer_card.get_value()) + + +def hit(): + global outcome, in_play, score1, score2, player_card, dealer_card, deck + if in_play == True: + player_card.add_card(deck.deal_card()) + + if player_card.get_value() > 21: + outcome = "you are busted" + in_play = False + + score1 = str(player_card.get_value()) + score2 = str(dealer_card.get_value()) + + +def draw(canvas): + canvas.draw_text(outcome, [250, 150], 25, "White") + canvas.draw_text("BlackJack", [250, 50], 40, "Black") + canvas.draw_text(score1, [100, 100], 40, "Red") + + player_card.draw(canvas, [20, 300]) + dealer_card.draw(canvas, [300, 300]) + canvas.draw_text(score2, [400, 100], 40, "Red") + + +frame = simplegui.create_frame("Blackjack", 600, 600) +frame.set_canvas_background("Green") + +frame.add_button("Deal", deal, 200) +frame.add_button("Hit", hit, 200) +frame.add_button("Stand", stand, 200) +frame.set_draw_handler(draw) + +deal() +frame.start() diff --git a/BoardGame-CLI/python.py b/boardgame-cli_1/python.py similarity index 100% rename from BoardGame-CLI/python.py rename to boardgame-cli_1/python.py diff --git a/BoardGame-CLI/snakeLadder.py b/boardgame-cli_1/snakeLadder.py similarity index 100% rename from BoardGame-CLI/snakeLadder.py rename to boardgame-cli_1/snakeLadder.py diff --git a/BoardGame-CLI/uno.py b/boardgame-cli_1/uno.py similarity index 100% rename from BoardGame-CLI/uno.py rename to boardgame-cli_1/uno.py diff --git a/BruteForce.py b/bruteforce_1.py similarity index 100% rename from BruteForce.py rename to bruteforce_1.py diff --git a/Caesar Cipher Encoder & Decoder.py b/caesar_cipher_encoder__&_decoder.py similarity index 100% rename from Caesar Cipher Encoder & Decoder.py rename to caesar_cipher_encoder__&_decoder.py diff --git a/Calculate resistance.py b/calculate_resistance.py similarity index 100% rename from Calculate resistance.py rename to calculate_resistance.py diff --git a/Calculator with simple ui.py b/calculator_with_simple_ui.py similarity index 100% rename from Calculator with simple ui.py rename to calculator_with_simple_ui.py diff --git a/Calendar (GUI) b/calendar_(gui) similarity index 100% rename from Calendar (GUI) rename to calendar_(gui) diff --git a/Cat/cat.py b/cat_1/cat.py similarity index 96% rename from Cat/cat.py rename to cat_1/cat.py index 552ed6c1e7a..52882e9c605 100644 --- a/Cat/cat.py +++ b/cat_1/cat.py @@ -1,59 +1,59 @@ -""" -The 'cat' Program Implemented in Python 3 - -The Unix 'cat' utility reads the contents -of file(s) specified through stdin and 'conCATenates' -into stdout. If it is run without any filename(s) given, -then the program reads from standard input itself, -which means it simply copies stdin to stdout. - -It is fairly easy to implement such a program -in Python, and as a result countless examples -exist online. This particular implementation -focuses on the basic functionality of the cat -utility. Compatible with Python 3.6 or higher. - -Syntax: -python3 cat.py [filename1] [filename2] etc... -Separate filenames with spaces. - -David Costell (DontEatThemCookies on GitHub) -v2 - 03/12/2022 -""" -import sys - -def with_files(files): - """Executes when file(s) is/are specified.""" - try: - # Read each file's contents and store them - file_contents = [contents for contents in [open(file).read() for file in files]] - except OSError as err: - # This executes when there's an error (e.g. FileNotFoundError) - exit(print(f"cat: error reading files ({err})")) - - # Write all file contents into the standard output stream - for contents in file_contents: - sys.stdout.write(contents) - -def no_files(): - """Executes when no file(s) is/are specified.""" - try: - # Get input, output the input, repeat - while True: - print(input()) - # Graceful exit for Ctrl + C, Ctrl + D - except KeyboardInterrupt: - exit() - except EOFError: - exit() - -def main(): - """Entry point of the cat program.""" - # Read the arguments passed to the program - if not sys.argv[1:]: - no_files() - else: - with_files(sys.argv[1:]) - -if __name__ == "__main__": - main() +""" +The 'cat' Program Implemented in Python 3 + +The Unix 'cat' utility reads the contents +of file(s) specified through stdin and 'conCATenates' +into stdout. If it is run without any filename(s) given, +then the program reads from standard input itself, +which means it simply copies stdin to stdout. + +It is fairly easy to implement such a program +in Python, and as a result countless examples +exist online. This particular implementation +focuses on the basic functionality of the cat +utility. Compatible with Python 3.6 or higher. + +Syntax: +python3 cat.py [filename1] [filename2] etc... +Separate filenames with spaces. + +David Costell (DontEatThemCookies on GitHub) +v2 - 03/12/2022 +""" +import sys + +def with_files(files): + """Executes when file(s) is/are specified.""" + try: + # Read each file's contents and store them + file_contents = [contents for contents in [open(file).read() for file in files]] + except OSError as err: + # This executes when there's an error (e.g. FileNotFoundError) + exit(print(f"cat: error reading files ({err})")) + + # Write all file contents into the standard output stream + for contents in file_contents: + sys.stdout.write(contents) + +def no_files(): + """Executes when no file(s) is/are specified.""" + try: + # Get input, output the input, repeat + while True: + print(input()) + # Graceful exit for Ctrl + C, Ctrl + D + except KeyboardInterrupt: + exit() + except EOFError: + exit() + +def main(): + """Entry point of the cat program.""" + # Read the arguments passed to the program + if not sys.argv[1:]: + no_files() + else: + with_files(sys.argv[1:]) + +if __name__ == "__main__": + main() diff --git a/Cat/text_a.txt b/cat_1/text_a.txt similarity index 91% rename from Cat/text_a.txt rename to cat_1/text_a.txt index 64da084448b..c7f60d6fe3d 100644 --- a/Cat/text_a.txt +++ b/cat_1/text_a.txt @@ -1,7 +1,7 @@ -Sample Text Here - -Lorem ipsum, dolor sit amet. -Hello, -World! - -ABCD 1234 +Sample Text Here + +Lorem ipsum, dolor sit amet. +Hello, +World! + +ABCD 1234 diff --git a/Cat/text_b.txt b/cat_1/text_b.txt similarity index 94% rename from Cat/text_b.txt rename to cat_1/text_b.txt index 359622ed342..0464f161971 100644 --- a/Cat/text_b.txt +++ b/cat_1/text_b.txt @@ -1,8 +1,8 @@ -I am another sample text file. - -The knights who say ni! - -Lines -of -Text! +I am another sample text file. + +The knights who say ni! + +Lines +of +Text! This file does not end with a newline. \ No newline at end of file diff --git a/Cat/text_c.txt b/cat_1/text_c.txt similarity index 95% rename from Cat/text_c.txt rename to cat_1/text_c.txt index d6b40d9f971..d6e287f021d 100644 --- a/Cat/text_c.txt +++ b/cat_1/text_c.txt @@ -1,3 +1,3 @@ -I am the beginning of yet another text file. - -Spam and eggs. +I am the beginning of yet another text file. + +Spam and eggs. diff --git a/check if a number positive , negative or zero b/check__if_a_number_positive_,_negative_or_zero similarity index 100% rename from check if a number positive , negative or zero rename to check__if_a_number_positive_,_negative_or_zero diff --git a/check whether the string is Symmetrical or Palindrome b/check_whether_the_string_is_symmetrical_or_palindrome similarity index 100% rename from check whether the string is Symmetrical or Palindrome rename to check_whether_the_string_is_symmetrical_or_palindrome diff --git a/Checker_game_by_dz/__init__.py b/checker_game_by_dz_1/__init__.py similarity index 100% rename from Checker_game_by_dz/__init__.py rename to checker_game_by_dz_1/__init__.py diff --git a/Checker_game_by_dz/assets/crown.png b/checker_game_by_dz_1/assets/crown.png similarity index 100% rename from Checker_game_by_dz/assets/crown.png rename to checker_game_by_dz_1/assets/crown.png diff --git a/Checker_game_by_dz/first.py b/checker_game_by_dz_1/first.py similarity index 100% rename from Checker_game_by_dz/first.py rename to checker_game_by_dz_1/first.py diff --git a/Checker_game_by_dz/modules/__init__.py b/checker_game_by_dz_1/modules/__init__.py similarity index 100% rename from Checker_game_by_dz/modules/__init__.py rename to checker_game_by_dz_1/modules/__init__.py diff --git a/Checker_game_by_dz/modules/checker.py b/checker_game_by_dz_1/modules/checker.py similarity index 100% rename from Checker_game_by_dz/modules/checker.py rename to checker_game_by_dz_1/modules/checker.py diff --git a/Checker_game_by_dz/modules/checker_board.py b/checker_game_by_dz_1/modules/checker_board.py similarity index 100% rename from Checker_game_by_dz/modules/checker_board.py rename to checker_game_by_dz_1/modules/checker_board.py diff --git a/Checker_game_by_dz/modules/pieces.py b/checker_game_by_dz_1/modules/pieces.py similarity index 100% rename from Checker_game_by_dz/modules/pieces.py rename to checker_game_by_dz_1/modules/pieces.py diff --git a/Checker_game_by_dz/modules/statics.py b/checker_game_by_dz_1/modules/statics.py similarity index 100% rename from Checker_game_by_dz/modules/statics.py rename to checker_game_by_dz_1/modules/statics.py diff --git a/Chrome Dino Automater.py b/chrome_dino_automater.py similarity index 100% rename from Chrome Dino Automater.py rename to chrome_dino_automater.py diff --git a/classicIndianCardMatch.py b/classicindiancardmatch_1.py similarity index 100% rename from classicIndianCardMatch.py rename to classicindiancardmatch_1.py diff --git a/Classification_human_or_horse.py b/classification_human_or_horse_1.py similarity index 96% rename from Classification_human_or_horse.py rename to classification_human_or_horse_1.py index 4aa069a855a..887b1f7d5da 100644 --- a/Classification_human_or_horse.py +++ b/classification_human_or_horse_1.py @@ -1,54 +1,54 @@ -import pickle - -import tensorflow as tf - -model = tf.keras.models.Sequential( - [ - tf.keras.layers.Conv2D( - 16, (3, 3), activation="relu", input_shape=(200, 200, 3) - ), - tf.keras.layers.MaxPooling2D(2, 2), - tf.keras.layers.Conv2D(16, (3, 3), activation="relu"), - tf.keras.layers.MaxPooling2D(2, 2), - tf.keras.layers.Conv2D(16, (3, 3), activation="relu"), - tf.keras.layers.MaxPooling2D(2, 2), - tf.keras.layers.Flatten(), - tf.keras.layers.Dense(512, activation="relu"), - tf.keras.layers.Dense(1, activation="sigmoid"), - ] -) -model.summary() -from tensorflow.keras.optimizers import RMSprop - -model.compile(optimizer=RMSprop(lr=0.001), loss="binary_crossentropy", metrics=["acc"]) -from tensorflow.keras.preprocessing.image import ImageDataGenerator - -train_datagen = ImageDataGenerator(rescale=1 / 255) -train_generator = train_datagen.flow_from_directory( - "../Classification_human-or-horse", - target_size=(200, 200), - batch_size=222, - class_mode="binary", -) -model.fit_generator(train_generator, steps_per_epoch=6, epochs=1, verbose=1) -filename = "myTf1.sav" -pickle.dump(model, open(filename, "wb")) - -from tkinter import Tk -from tkinter.filedialog import askopenfilename -from keras.preprocessing import image -import numpy as np - -Tk().withdraw() -filename = askopenfilename() -print(filename) -img = image.load_img(filename, target_size=(200, 200)) -x = image.img_to_array(img) -x = np.expand_dims(x, axis=0) -images = np.vstack([x]) -classes = model.predict(images, batch_size=10) -print(classes[0]) -if classes[0] > 0.5: - print(filename + " is a human") -else: - print(filename + " is a horse") +import pickle + +import tensorflow as tf + +model = tf.keras.models.Sequential( + [ + tf.keras.layers.Conv2D( + 16, (3, 3), activation="relu", input_shape=(200, 200, 3) + ), + tf.keras.layers.MaxPooling2D(2, 2), + tf.keras.layers.Conv2D(16, (3, 3), activation="relu"), + tf.keras.layers.MaxPooling2D(2, 2), + tf.keras.layers.Conv2D(16, (3, 3), activation="relu"), + tf.keras.layers.MaxPooling2D(2, 2), + tf.keras.layers.Flatten(), + tf.keras.layers.Dense(512, activation="relu"), + tf.keras.layers.Dense(1, activation="sigmoid"), + ] +) +model.summary() +from tensorflow.keras.optimizers import RMSprop + +model.compile(optimizer=RMSprop(lr=0.001), loss="binary_crossentropy", metrics=["acc"]) +from tensorflow.keras.preprocessing.image import ImageDataGenerator + +train_datagen = ImageDataGenerator(rescale=1 / 255) +train_generator = train_datagen.flow_from_directory( + "../Classification_human-or-horse", + target_size=(200, 200), + batch_size=222, + class_mode="binary", +) +model.fit_generator(train_generator, steps_per_epoch=6, epochs=1, verbose=1) +filename = "myTf1.sav" +pickle.dump(model, open(filename, "wb")) + +from tkinter import Tk +from tkinter.filedialog import askopenfilename +from keras.preprocessing import image +import numpy as np + +Tk().withdraw() +filename = askopenfilename() +print(filename) +img = image.load_img(filename, target_size=(200, 200)) +x = image.img_to_array(img) +x = np.expand_dims(x, axis=0) +images = np.vstack([x]) +classes = model.predict(images, batch_size=10) +print(classes[0]) +if classes[0] > 0.5: + print(filename + " is a human") +else: + print(filename + " is a horse") diff --git a/CliYoutubeDownloader.py b/cliyoutubedownloader_1.py similarity index 96% rename from CliYoutubeDownloader.py rename to cliyoutubedownloader_1.py index 7b9d3d4bf1d..8bfa0f371ab 100644 --- a/CliYoutubeDownloader.py +++ b/cliyoutubedownloader_1.py @@ -1,88 +1,88 @@ -from pytube import * -import sys - - -class YouTubeDownloder: - def __init__(self): - self.url = str(input("Enter the url of video : ")) - self.youtube = YouTube( - self.url, on_progress_callback=YouTubeDownloder.onProgress - ) - self.showTitle() - - def showTitle(self): - print("title : {0}\n".format(self.youtube.title)) - self.showStreams() - - def showStreams(self): - self.streamNo = 1 - for stream in self.youtube.streams: - print( - "{0} => resolation:{1}/fps:{2}/type:{3}".format( - self.streamNo, stream.resolution, stream.fps, stream.type - ) - ) - self.streamNo += 1 - self.chooseStream() - - def chooseStream(self): - self.choose = int(input("please select one : ")) - self.validateChooseValue() - - def validateChooseValue(self): - if self.choose in range(1, self.streamNo): - self.getStream() - else: - print("please enter a currect option on the list.") - self.chooseStream() - - def getStream(self): - self.stream = self.youtube.streams[self.choose - 1] - self.getFileSize() - - def getFileSize(self): - global file_size - file_size = self.stream.filesize / 1000000 - self.getPermisionToContinue() - - def getPermisionToContinue(self): - print( - "\n title : {0} \n author : {1} \n size : {2:.2f}MB \n resolution : {3} \n fps : {4} \n ".format( - self.youtube.title, - self.youtube.author, - file_size, - self.stream.resolution, - self.stream.fps, - ) - ) - if input("do you want it ?(defualt = (y)es) or (n)o ") == "n": - self.showStreams() - else: - self.main() - - def download(self): - self.stream.download() - - @staticmethod - def onProgress(stream=None, chunk=None, remaining=None): - file_downloaded = file_size - (remaining / 1000000) - print( - f"downloading ... {file_downloaded/file_size*100:0.2f} % [{file_downloaded:.1f}MB of {file_size:.1f}MB]", - end="\r", - ) - - def main(self): - try: - self.download() - except KeyboardInterrupt: - print("Canceled. ") - sys.exit(0) - - -if __name__ == "__main__": - try: - YouTubeDownloder() - except KeyboardInterrupt: - pass - except Exception as e: - print(e) +from pytube import * +import sys + + +class YouTubeDownloder: + def __init__(self): + self.url = str(input("Enter the url of video : ")) + self.youtube = YouTube( + self.url, on_progress_callback=YouTubeDownloder.onProgress + ) + self.showTitle() + + def showTitle(self): + print("title : {0}\n".format(self.youtube.title)) + self.showStreams() + + def showStreams(self): + self.streamNo = 1 + for stream in self.youtube.streams: + print( + "{0} => resolation:{1}/fps:{2}/type:{3}".format( + self.streamNo, stream.resolution, stream.fps, stream.type + ) + ) + self.streamNo += 1 + self.chooseStream() + + def chooseStream(self): + self.choose = int(input("please select one : ")) + self.validateChooseValue() + + def validateChooseValue(self): + if self.choose in range(1, self.streamNo): + self.getStream() + else: + print("please enter a currect option on the list.") + self.chooseStream() + + def getStream(self): + self.stream = self.youtube.streams[self.choose - 1] + self.getFileSize() + + def getFileSize(self): + global file_size + file_size = self.stream.filesize / 1000000 + self.getPermisionToContinue() + + def getPermisionToContinue(self): + print( + "\n title : {0} \n author : {1} \n size : {2:.2f}MB \n resolution : {3} \n fps : {4} \n ".format( + self.youtube.title, + self.youtube.author, + file_size, + self.stream.resolution, + self.stream.fps, + ) + ) + if input("do you want it ?(defualt = (y)es) or (n)o ") == "n": + self.showStreams() + else: + self.main() + + def download(self): + self.stream.download() + + @staticmethod + def onProgress(stream=None, chunk=None, remaining=None): + file_downloaded = file_size - (remaining / 1000000) + print( + f"downloading ... {file_downloaded/file_size*100:0.2f} % [{file_downloaded:.1f}MB of {file_size:.1f}MB]", + end="\r", + ) + + def main(self): + try: + self.download() + except KeyboardInterrupt: + print("Canceled. ") + sys.exit(0) + + +if __name__ == "__main__": + try: + YouTubeDownloder() + except KeyboardInterrupt: + pass + except Exception as e: + print(e) diff --git a/CliYoutubeDownloader/CliYoutubeDownloader.py b/cliyoutubedownloader_1/CliYoutubeDownloader.py similarity index 100% rename from CliYoutubeDownloader/CliYoutubeDownloader.py rename to cliyoutubedownloader_1/CliYoutubeDownloader.py diff --git a/CliYoutubeDownloader/requirements.txt b/cliyoutubedownloader_1/requirements.txt similarity index 100% rename from CliYoutubeDownloader/requirements.txt rename to cliyoutubedownloader_1/requirements.txt diff --git a/CODE_OF_CONDUCT.md b/code_of_conduct_1.md similarity index 100% rename from CODE_OF_CONDUCT.md rename to code_of_conduct_1.md diff --git a/Collatz-Conjecture.py b/collatz-conjecture_1.py similarity index 100% rename from Collatz-Conjecture.py rename to collatz-conjecture_1.py diff --git a/Colors/multicoloredline.py b/colors_1/multicoloredline.py similarity index 100% rename from Colors/multicoloredline.py rename to colors_1/multicoloredline.py diff --git a/Colors/pixel_sort.py b/colors_1/pixel_sort.py similarity index 100% rename from Colors/pixel_sort.py rename to colors_1/pixel_sort.py diff --git a/Colors/primary_colors.py b/colors_1/primary_colors.py similarity index 100% rename from Colors/primary_colors.py rename to colors_1/primary_colors.py diff --git a/Colors/print_colors.py b/colors_1/print_colors.py similarity index 100% rename from Colors/print_colors.py rename to colors_1/print_colors.py diff --git a/colour spiral.py b/colour_spiral.py similarity index 100% rename from colour spiral.py rename to colour_spiral.py diff --git a/Compression_Analysis/PSNR.py b/compression_analysis_1/PSNR.py similarity index 100% rename from Compression_Analysis/PSNR.py rename to compression_analysis_1/PSNR.py diff --git a/Compression_Analysis/compressed_image.png b/compression_analysis_1/compressed_image.png similarity index 100% rename from Compression_Analysis/compressed_image.png rename to compression_analysis_1/compressed_image.png diff --git a/Compression_Analysis/example_image.jpg b/compression_analysis_1/example_image.jpg similarity index 100% rename from Compression_Analysis/example_image.jpg rename to compression_analysis_1/example_image.jpg diff --git a/Compression_Analysis/orignal_image.png b/compression_analysis_1/orignal_image.png similarity index 100% rename from Compression_Analysis/orignal_image.png rename to compression_analysis_1/orignal_image.png diff --git a/CONTRIBUTING.md b/contributing_1.md similarity index 100% rename from CONTRIBUTING.md rename to contributing_1.md diff --git a/Conversation.py b/conversation_1.py similarity index 100% rename from Conversation.py rename to conversation_1.py diff --git a/convert celsius into fahrenheit.py b/convert_celsius_into_fahrenheit.py similarity index 100% rename from convert celsius into fahrenheit.py rename to convert_celsius_into_fahrenheit.py diff --git a/Count the Number of Each Vowel b/count_the_number_of_each_vowel similarity index 100% rename from Count the Number of Each Vowel rename to count_the_number_of_each_vowel diff --git a/count the numbers of two vovels.py b/count_the_numbers_of_two_vovels.py similarity index 100% rename from count the numbers of two vovels.py rename to count_the_numbers_of_two_vovels.py diff --git a/CountMillionCharacter.py b/countmillioncharacter_1.py similarity index 100% rename from CountMillionCharacter.py rename to countmillioncharacter_1.py diff --git a/CountMillionCharacters-2.0.py b/countmillioncharacters-2.0_1.py similarity index 100% rename from CountMillionCharacters-2.0.py rename to countmillioncharacters-2.0_1.py diff --git a/CountMillionCharacters-Variations/variation1.py b/countmillioncharacters-variations_1/variation1.py similarity index 100% rename from CountMillionCharacters-Variations/variation1.py rename to countmillioncharacters-variations_1/variation1.py diff --git a/Crack_password.py b/crack_password_1.py similarity index 100% rename from Crack_password.py rename to crack_password_1.py diff --git a/CRC/crc.py b/crc_1/crc.py similarity index 96% rename from CRC/crc.py rename to crc_1/crc.py index d3d302244b7..a02987d6a46 100644 --- a/CRC/crc.py +++ b/crc_1/crc.py @@ -1,55 +1,55 @@ -def crc_check(data, div): - l = len(div) - ct = 0 - data = [int(i) for i in data] - div = [int(i) for i in div] - zero = [0 for i in range(l)] - temp_data = [data[i] for i in range(l)] - result = [] - for j in range(len(data) - len(div) + 1): - print("Temp_dividend", temp_data) - msb = temp_data[0] - if msb == 0: - result.append(0) - for i in range(l - 1, -1, -1): - temp_data[i] = temp_data[i] ^ zero[i] - else: - result.append(1) - for i in range(l - 1, -1, -1): - temp_data[i] = temp_data[i] ^ div[i] - temp_data.pop(0) - if l + j < len(data): - temp_data.append(data[l + j]) - crc = temp_data - print("Quotient: ", result, "remainder", crc) - return crc - - -# returning crc value - - -while 1 > 0: - print("Enter data: ") - data = input() # can use it like int(input()) - print("Enter divisor") - div = input() # can use it like int(input()) - original_data = data - data = data + ("0" * (len(div) - 1)) - crc = crc_check(data, div) - crc_str = "" - for c in crc: - crc_str += c - print("Sent data: ", original_data + crc_str) - sent_data = original_data + crc_str - print( - "If again applying CRC algorithm, the remainder/CRC must be zero if errorless." - ) - crc = crc_check(sent_data, div) - remainder = crc - print("Receiver side remainder: ", remainder) - print("Continue [Y/N]:") - ch = input() - if ch == "N" or ch == "n": - break - else: - continue +def crc_check(data, div): + l = len(div) + ct = 0 + data = [int(i) for i in data] + div = [int(i) for i in div] + zero = [0 for i in range(l)] + temp_data = [data[i] for i in range(l)] + result = [] + for j in range(len(data) - len(div) + 1): + print("Temp_dividend", temp_data) + msb = temp_data[0] + if msb == 0: + result.append(0) + for i in range(l - 1, -1, -1): + temp_data[i] = temp_data[i] ^ zero[i] + else: + result.append(1) + for i in range(l - 1, -1, -1): + temp_data[i] = temp_data[i] ^ div[i] + temp_data.pop(0) + if l + j < len(data): + temp_data.append(data[l + j]) + crc = temp_data + print("Quotient: ", result, "remainder", crc) + return crc + + +# returning crc value + + +while 1 > 0: + print("Enter data: ") + data = input() # can use it like int(input()) + print("Enter divisor") + div = input() # can use it like int(input()) + original_data = data + data = data + ("0" * (len(div) - 1)) + crc = crc_check(data, div) + crc_str = "" + for c in crc: + crc_str += c + print("Sent data: ", original_data + crc_str) + sent_data = original_data + crc_str + print( + "If again applying CRC algorithm, the remainder/CRC must be zero if errorless." + ) + crc = crc_check(sent_data, div) + remainder = crc + print("Receiver side remainder: ", remainder) + print("Continue [Y/N]:") + ch = input() + if ch == "N" or ch == "n": + break + else: + continue diff --git a/create password validity in python.py b/create_password_validity_in_python.py similarity index 95% rename from create password validity in python.py rename to create_password_validity_in_python.py index 46793e91061..b8ef37cf49b 100644 --- a/create password validity in python.py +++ b/create_password_validity_in_python.py @@ -1,24 +1,24 @@ -import time -pwd=input("Enter your password: ") #any password u want to set - -def IInd_func(): - count1=0 - for j in range(5): - a=0 - count=0 - user_pwd = input("Enter remember password: ") #password you remember - for i in range(len(pwd)): - if user_pwd[i] == pwd[a]: #comparing remembered pwd with fixed pwd - a +=1 - count+=1 - if count==len(pwd): - print("correct pwd") - break - else: - count1 += 1 - print("not correct") - if count1==5: - time.sleep(30) - IInd_func() - +import time +pwd=input("Enter your password: ") #any password u want to set + +def IInd_func(): + count1=0 + for j in range(5): + a=0 + count=0 + user_pwd = input("Enter remember password: ") #password you remember + for i in range(len(pwd)): + if user_pwd[i] == pwd[a]: #comparing remembered pwd with fixed pwd + a +=1 + count+=1 + if count==len(pwd): + print("correct pwd") + break + else: + count1 += 1 + print("not correct") + if count1==5: + time.sleep(30) + IInd_func() + IInd_func() \ No newline at end of file diff --git a/Credit_Card_Validator.py b/credit_card_validator_1.py similarity index 96% rename from Credit_Card_Validator.py rename to credit_card_validator_1.py index 08100e781fd..adba76b1021 100644 --- a/Credit_Card_Validator.py +++ b/credit_card_validator_1.py @@ -1,88 +1,88 @@ -# luhn algorithm - - -class CreditCard: - def __init__(self, card_no): - self.card_no = card_no - - @property - def company(self): - comp = None - if str(self.card_no).startswith("4"): - comp = "Visa Card" - elif str(self.card_no).startswith( - ( - "50", - "67", - "58", - "63", - ) - ): - comp = "Maestro Card" - elif str(self.card_no).startswith("5"): - comp = "Master Card" - elif str(self.card_no).startswith("37"): - comp = "American Express Card" - elif str(self.card_no).startswith("62"): - comp = "Unionpay Card" - elif str(self.card_no).startswith("6"): - comp = "Discover Card" - elif str(self.card_no).startswith("35"): - comp = "JCB Card" - elif str(self.card_no).startswith("7"): - comp = "Gasoline Card" - - return "Company : " + comp - - def first_check(self): - if 13 <= len(self.card_no) <= 19: - message = "First check : Valid in terms of length." - - else: - message = "First check : Check Card number once again it must be of 13 or 16 digits long." - return message - - def validate(self): - # double every second digit from right to left - sum_ = 0 - crd_no = self.card_no[::-1] - for i in range(len(crd_no)): - if i % 2 == 1: - double_it = int(crd_no[i]) * 2 - - if len(str(double_it)) == 2: - sum_ += sum([eval(i) for i in str(double_it)]) - - else: - sum_ += double_it - - else: - sum_ += int(crd_no[i]) - - if sum_ % 10 == 0: - response = "Valid Card" - else: - response = "Invalid Card" - - return response - - @property - def checksum(self): - return "#CHECKSUM# : " + self.card_no[-1] - - @classmethod - def set_card(cls, card_to_check): - return cls(card_to_check) - - -card_number = input() -card = CreditCard.set_card(card_number) -print(card.company) -print("Card : ", card.card_no) -print(card.first_check()) -print(card.checksum) -print(card.validate()) - -# 79927398713 -# 4388576018402626 -# 379354508162306 +# luhn algorithm + + +class CreditCard: + def __init__(self, card_no): + self.card_no = card_no + + @property + def company(self): + comp = None + if str(self.card_no).startswith("4"): + comp = "Visa Card" + elif str(self.card_no).startswith( + ( + "50", + "67", + "58", + "63", + ) + ): + comp = "Maestro Card" + elif str(self.card_no).startswith("5"): + comp = "Master Card" + elif str(self.card_no).startswith("37"): + comp = "American Express Card" + elif str(self.card_no).startswith("62"): + comp = "Unionpay Card" + elif str(self.card_no).startswith("6"): + comp = "Discover Card" + elif str(self.card_no).startswith("35"): + comp = "JCB Card" + elif str(self.card_no).startswith("7"): + comp = "Gasoline Card" + + return "Company : " + comp + + def first_check(self): + if 13 <= len(self.card_no) <= 19: + message = "First check : Valid in terms of length." + + else: + message = "First check : Check Card number once again it must be of 13 or 16 digits long." + return message + + def validate(self): + # double every second digit from right to left + sum_ = 0 + crd_no = self.card_no[::-1] + for i in range(len(crd_no)): + if i % 2 == 1: + double_it = int(crd_no[i]) * 2 + + if len(str(double_it)) == 2: + sum_ += sum([eval(i) for i in str(double_it)]) + + else: + sum_ += double_it + + else: + sum_ += int(crd_no[i]) + + if sum_ % 10 == 0: + response = "Valid Card" + else: + response = "Invalid Card" + + return response + + @property + def checksum(self): + return "#CHECKSUM# : " + self.card_no[-1] + + @classmethod + def set_card(cls, card_to_check): + return cls(card_to_check) + + +card_number = input() +card = CreditCard.set_card(card_number) +print(card.company) +print("Card : ", card.card_no) +print(card.first_check()) +print(card.checksum) +print(card.validate()) + +# 79927398713 +# 4388576018402626 +# 379354508162306 diff --git a/Cricket_score.py b/cricket_score_1.py similarity index 100% rename from Cricket_score.py rename to cricket_score_1.py diff --git a/currency converter/README.md b/currency_converter/README.md similarity index 100% rename from currency converter/README.md rename to currency_converter/README.md diff --git a/currency converter/country.txt b/currency_converter/country.txt similarity index 100% rename from currency converter/country.txt rename to currency_converter/country.txt diff --git a/currency converter/gui.ui b/currency_converter/gui.ui similarity index 100% rename from currency converter/gui.ui rename to currency_converter/gui.ui diff --git a/currency converter/main.py b/currency_converter/main.py similarity index 100% rename from currency converter/main.py rename to currency_converter/main.py diff --git a/Day_of_week.py b/day_of_week_1.py similarity index 100% rename from Day_of_week.py rename to day_of_week_1.py diff --git a/Decimal number to binary function.py b/decimal_number_to_binary_function.py similarity index 100% rename from Decimal number to binary function.py rename to decimal_number_to_binary_function.py diff --git a/decimal to binary b/decimal_to_binary similarity index 100% rename from decimal to binary rename to decimal_to_binary diff --git a/Decimal_To_Binary.py b/decimal_to_binary_1.py similarity index 95% rename from Decimal_To_Binary.py rename to decimal_to_binary_1.py index a8e85097a14..47914fe3825 100644 --- a/Decimal_To_Binary.py +++ b/decimal_to_binary_1.py @@ -1,67 +1,67 @@ -# patch-255 -decimal_accuracy = 7 - - -def dtbconverter(num): - - whole = [] - fractional = ["."] - - decimal = round(num % 1, decimal_accuracy) - w_num = int(num) - - i = 0 - while decimal != 1 and i < decimal_accuracy: - decimal = decimal * 2 - fractional.append(int(decimal // 1)) - decimal = round(decimal % 1, decimal_accuracy) - if decimal == 0: - break - i += 1 - - while w_num != 0: - whole.append(w_num % 2) - w_num = w_num // 2 - whole.reverse() - - i = 0 - while i < len(whole): - print(whole[i], end="") - i += 1 - i = 0 - while i < len(fractional): - print(fractional[i], end="") - i += 1 - - -number = float(input("Enter Any base-10 Number: ")) - -dtbconverter(number) - - -# i think this code have not proper comment and noe this is easy to understand -""" -======= -Program: Decimal to Binary converter. - -THis program accepts fractional values, the accuracy can be set below: -""" - -# Function to convert decimal number -# to binary using recursion -def DecimalToBinary(num): - - if num > 1: - DecimalToBinary(num // 2) - print(num % 2, end="") - - -# Driver Code -if __name__ == "__main__": - - # decimal value - dec_val = 24 - - # Calling function - DecimalToBinary(dec_val) -# master +# patch-255 +decimal_accuracy = 7 + + +def dtbconverter(num): + + whole = [] + fractional = ["."] + + decimal = round(num % 1, decimal_accuracy) + w_num = int(num) + + i = 0 + while decimal != 1 and i < decimal_accuracy: + decimal = decimal * 2 + fractional.append(int(decimal // 1)) + decimal = round(decimal % 1, decimal_accuracy) + if decimal == 0: + break + i += 1 + + while w_num != 0: + whole.append(w_num % 2) + w_num = w_num // 2 + whole.reverse() + + i = 0 + while i < len(whole): + print(whole[i], end="") + i += 1 + i = 0 + while i < len(fractional): + print(fractional[i], end="") + i += 1 + + +number = float(input("Enter Any base-10 Number: ")) + +dtbconverter(number) + + +# i think this code have not proper comment and noe this is easy to understand +""" +======= +Program: Decimal to Binary converter. + +THis program accepts fractional values, the accuracy can be set below: +""" + +# Function to convert decimal number +# to binary using recursion +def DecimalToBinary(num): + + if num > 1: + DecimalToBinary(num // 2) + print(num % 2, end="") + + +# Driver Code +if __name__ == "__main__": + + # decimal value + dec_val = 24 + + # Calling function + DecimalToBinary(dec_val) +# master diff --git a/Delete_Linked_List.py b/delete_linked_list_1.py similarity index 96% rename from Delete_Linked_List.py rename to delete_linked_list_1.py index 263f69eb986..1bbd916d42d 100644 --- a/Delete_Linked_List.py +++ b/delete_linked_list_1.py @@ -1,58 +1,58 @@ -class Node: - def __init__(self, data): - self.data = data - self.next = None - - -class Linked_List: - def __init__(self): - self.head = None - - def Insert_At_End(self, new_data): - new_node = Node(new_data) - if self.head is None: - self.head = new_node - return - current = self.head - while current.next: - current = current.next - current.next = new_node - - def Delete(self, key): - temp = self.head - if temp is None: - return "Can't Delete!" - else: - if temp.data == key: - self.head = temp.next - temp = None - while temp is not None: - prev = temp - temp = temp.next - curr = temp.next - if temp.data == key: - prev.next = curr - return - - def Display(self): - temp = self.head - while temp: - print(temp.data, "->", end=" ") - temp = temp.next - print("None") - - -if __name__ == "__main__": - L_list = Linked_List() - L_list.Insert_At_End(1) - L_list.Insert_At_End(2) - L_list.Insert_At_End(3) - L_list.Insert_At_End(4) - L_list.Insert_At_End(5) - L_list.Insert_At_End(6) - L_list.Insert_At_End(7) - print("Linked List: ") - L_list.Display() - print("Deleted Linked List: ") - L_list.Delete(3) - L_list.Display() +class Node: + def __init__(self, data): + self.data = data + self.next = None + + +class Linked_List: + def __init__(self): + self.head = None + + def Insert_At_End(self, new_data): + new_node = Node(new_data) + if self.head is None: + self.head = new_node + return + current = self.head + while current.next: + current = current.next + current.next = new_node + + def Delete(self, key): + temp = self.head + if temp is None: + return "Can't Delete!" + else: + if temp.data == key: + self.head = temp.next + temp = None + while temp is not None: + prev = temp + temp = temp.next + curr = temp.next + if temp.data == key: + prev.next = curr + return + + def Display(self): + temp = self.head + while temp: + print(temp.data, "->", end=" ") + temp = temp.next + print("None") + + +if __name__ == "__main__": + L_list = Linked_List() + L_list.Insert_At_End(1) + L_list.Insert_At_End(2) + L_list.Insert_At_End(3) + L_list.Insert_At_End(4) + L_list.Insert_At_End(5) + L_list.Insert_At_End(6) + L_list.Insert_At_End(7) + print("Linked List: ") + L_list.Display() + print("Deleted Linked List: ") + L_list.Delete(3) + L_list.Display() diff --git a/Detect_Remove_loop.py b/detect_remove_loop_1.py similarity index 96% rename from Detect_Remove_loop.py rename to detect_remove_loop_1.py index 6aad9f879b9..e38d4291377 100644 --- a/Detect_Remove_loop.py +++ b/detect_remove_loop_1.py @@ -1,65 +1,65 @@ -class Node: - def __init__(self, data): - self.data = data - self.next = None - - -class Linked_List: - def __init__(self): - self.head = None - - def Insert_At_End(self, new_data): - new_node = Node(new_data) - if self.head is None: - self.head = new_node - return - current = self.head - while current.next: - current = current.next - current.next = new_node - - def Detect_and_Remove_Loop(self): - slow = fast = self.head - while slow and fast and fast.next: - slow = slow.next - fast = fast.next.next - if slow == fast: - self.Remove_loop(slow) - print("Loop Found") - return 1 - return 0 - - def Remove_loop(self, Loop_node): - ptr1 = self.head - while 1: - ptr2 = Loop_node - while ptr2.next != Loop_node and ptr2.next != ptr1: - ptr2 = ptr2.next - if ptr2.next == ptr1: - break - ptr1 = ptr1.next - ptr2.next = None - - def Display(self): - temp = self.head - while temp: - print(temp.data, "->", end=" ") - temp = temp.next - print("None") - - -if __name__ == "__main__": - L_list = Linked_List() - L_list.Insert_At_End(8) - L_list.Insert_At_End(5) - L_list.Insert_At_End(10) - L_list.Insert_At_End(7) - L_list.Insert_At_End(6) - L_list.Insert_At_End(11) - L_list.Insert_At_End(9) - print("Linked List with Loop: ") - L_list.Display() - print("Linked List without Loop: ") - L_list.head.next.next.next.next.next.next.next = L_list.head.next.next - L_list.Detect_and_Remove_Loop() - L_list.Display() +class Node: + def __init__(self, data): + self.data = data + self.next = None + + +class Linked_List: + def __init__(self): + self.head = None + + def Insert_At_End(self, new_data): + new_node = Node(new_data) + if self.head is None: + self.head = new_node + return + current = self.head + while current.next: + current = current.next + current.next = new_node + + def Detect_and_Remove_Loop(self): + slow = fast = self.head + while slow and fast and fast.next: + slow = slow.next + fast = fast.next.next + if slow == fast: + self.Remove_loop(slow) + print("Loop Found") + return 1 + return 0 + + def Remove_loop(self, Loop_node): + ptr1 = self.head + while 1: + ptr2 = Loop_node + while ptr2.next != Loop_node and ptr2.next != ptr1: + ptr2 = ptr2.next + if ptr2.next == ptr1: + break + ptr1 = ptr1.next + ptr2.next = None + + def Display(self): + temp = self.head + while temp: + print(temp.data, "->", end=" ") + temp = temp.next + print("None") + + +if __name__ == "__main__": + L_list = Linked_List() + L_list.Insert_At_End(8) + L_list.Insert_At_End(5) + L_list.Insert_At_End(10) + L_list.Insert_At_End(7) + L_list.Insert_At_End(6) + L_list.Insert_At_End(11) + L_list.Insert_At_End(9) + print("Linked List with Loop: ") + L_list.Display() + print("Linked List without Loop: ") + L_list.head.next.next.next.next.next.next.next = L_list.head.next.next + L_list.Detect_and_Remove_Loop() + L_list.Display() diff --git a/diceV2_dynamic.py b/dicev2_dynamic_1.py similarity index 100% rename from diceV2_dynamic.py rename to dicev2_dynamic_1.py diff --git a/Dictionary opperations (input,update a dict).py b/dictionary_opperations_(input,update_a_dict).py similarity index 95% rename from Dictionary opperations (input,update a dict).py rename to dictionary_opperations_(input,update_a_dict).py index 6a157b3578e..1424d5d9973 100644 --- a/Dictionary opperations (input,update a dict).py +++ b/dictionary_opperations_(input,update_a_dict).py @@ -1,21 +1,21 @@ -# Update the value of dictionary written by the user... - -print("Dictinary opperations") - - -def Dictionary(Dict, key, value): - print("Original dictionary", Dict) - Dict[key] = value - print("Updated dictionary", Dict) - - -d = eval(input("Enter the dictionary")) -print("Dictionary", d, "\n") - -k = input("Enter the key to be updated") -if k in d.keys(): - v = input("Enter the updated value") - Dictionary(d, k, v) - -else: - print("Key not found") +# Update the value of dictionary written by the user... + +print("Dictinary opperations") + + +def Dictionary(Dict, key, value): + print("Original dictionary", Dict) + Dict[key] = value + print("Updated dictionary", Dict) + + +d = eval(input("Enter the dictionary")) +print("Dictionary", d, "\n") + +k = input("Enter the key to be updated") +if k in d.keys(): + v = input("Enter the updated value") + Dictionary(d, k, v) + +else: + print("Key not found") diff --git a/different model output b/different_model_output similarity index 100% rename from different model output rename to different_model_output diff --git a/Differentiate_List.py b/differentiate_list_1.py similarity index 100% rename from Differentiate_List.py rename to differentiate_list_1.py diff --git a/Divide Operator.py b/divide_operator.py similarity index 100% rename from Divide Operator.py rename to divide_operator.py diff --git a/Downloaded Files Organizer/browser_status.py b/downloaded_files_organizer/browser_status.py similarity index 100% rename from Downloaded Files Organizer/browser_status.py rename to downloaded_files_organizer/browser_status.py diff --git a/Downloaded Files Organizer/move_to_directory.py b/downloaded_files_organizer/move_to_directory.py similarity index 100% rename from Downloaded Files Organizer/move_to_directory.py rename to downloaded_files_organizer/move_to_directory.py diff --git a/Downloaded Files Organizer/obs.py b/downloaded_files_organizer/obs.py similarity index 100% rename from Downloaded Files Organizer/obs.py rename to downloaded_files_organizer/obs.py diff --git a/Downloaded Files Organizer/readme.md b/downloaded_files_organizer/readme.md similarity index 100% rename from Downloaded Files Organizer/readme.md rename to downloaded_files_organizer/readme.md diff --git a/Downloaded Files Organizer/requirements.txt b/downloaded_files_organizer/requirements.txt similarity index 100% rename from Downloaded Files Organizer/requirements.txt rename to downloaded_files_organizer/requirements.txt diff --git a/Droplistmenu/GamesCalender.py b/droplistmenu_1/GamesCalender.py similarity index 95% rename from Droplistmenu/GamesCalender.py rename to droplistmenu_1/GamesCalender.py index 990a164bd93..c233ac92755 100644 --- a/Droplistmenu/GamesCalender.py +++ b/droplistmenu_1/GamesCalender.py @@ -1,71 +1,71 @@ - -from tkinter import * -from tkcalendar import Calendar -import tkinter as tk - - -window = tk.Tk() - -# Adjust size -window.geometry("600x500") - -gameList =["Game List:"] -# Change the label text -def show(): - game = selected1.get() + " vs " + selected2.get()+" on "+cal.get_date() - gameList.append(game) - #print(gameList) - gameListshow = "\n".join(gameList) - #print(gameList) - label.config(text=gameListshow) - - -# Dropdown menu options -options = [ - "Team 1", - "Team 2", - "Team 3", - "Team 4", - "Team 5", - "Team 6" -] - -# datatype of menu text -selected1 = StringVar() -selected2 = StringVar() - -# initial menu text -selected1.set("Team 1") -selected2.set("Team 2") - -# Create Dropdown menu -L1 = Label(window, text="Visitor") -L1.place(x=40, y=35) -drop1 = OptionMenu(window, selected1, *options) -drop1.place(x=100, y=30) - -L2 = Label(window, text="VS") -L2.place(x=100, y=80) - -L3 = Label(window, text="Home") -L3.place(x=40, y=115) -drop2 = OptionMenu(window, selected2, *options) -drop2.place(x=100, y=110) - -# Add Calendar -cal = Calendar(window, selectmode='day', - year=2022, month=12, - day=1) - -cal.place(x=300, y=20) - - - -# Create button, it will change label text -button = Button( window, text="Add to calender", command=show).place(x=100,y=200) - -# Create Label -label = Label(window, text=" ") -label.place(x=150, y=250) - + +from tkinter import * +from tkcalendar import Calendar +import tkinter as tk + + +window = tk.Tk() + +# Adjust size +window.geometry("600x500") + +gameList =["Game List:"] +# Change the label text +def show(): + game = selected1.get() + " vs " + selected2.get()+" on "+cal.get_date() + gameList.append(game) + #print(gameList) + gameListshow = "\n".join(gameList) + #print(gameList) + label.config(text=gameListshow) + + +# Dropdown menu options +options = [ + "Team 1", + "Team 2", + "Team 3", + "Team 4", + "Team 5", + "Team 6" +] + +# datatype of menu text +selected1 = StringVar() +selected2 = StringVar() + +# initial menu text +selected1.set("Team 1") +selected2.set("Team 2") + +# Create Dropdown menu +L1 = Label(window, text="Visitor") +L1.place(x=40, y=35) +drop1 = OptionMenu(window, selected1, *options) +drop1.place(x=100, y=30) + +L2 = Label(window, text="VS") +L2.place(x=100, y=80) + +L3 = Label(window, text="Home") +L3.place(x=40, y=115) +drop2 = OptionMenu(window, selected2, *options) +drop2.place(x=100, y=110) + +# Add Calendar +cal = Calendar(window, selectmode='day', + year=2022, month=12, + day=1) + +cal.place(x=300, y=20) + + + +# Create button, it will change label text +button = Button( window, text="Add to calender", command=show).place(x=100,y=200) + +# Create Label +label = Label(window, text=" ") +label.place(x=150, y=250) + window.mainloop() \ No newline at end of file diff --git a/Droplistmenu/README.md b/droplistmenu_1/README.md similarity index 100% rename from Droplistmenu/README.md rename to droplistmenu_1/README.md diff --git a/Eight_Puzzle_Solver/eight_puzzle.py b/eight_puzzle_solver_1/eight_puzzle.py similarity index 100% rename from Eight_Puzzle_Solver/eight_puzzle.py rename to eight_puzzle_solver_1/eight_puzzle.py diff --git a/Electronics_Algorithms/Ohms_law.py b/electronics_algorithms_1/Ohms_law.py similarity index 100% rename from Electronics_Algorithms/Ohms_law.py rename to electronics_algorithms_1/Ohms_law.py diff --git a/Electronics_Algorithms/resistance.py b/electronics_algorithms_1/resistance.py similarity index 100% rename from Electronics_Algorithms/resistance.py rename to electronics_algorithms_1/resistance.py diff --git a/Email-Automation.py b/email-automation_1.py similarity index 95% rename from Email-Automation.py rename to email-automation_1.py index 6b37f3e111c..3439af15679 100644 --- a/Email-Automation.py +++ b/email-automation_1.py @@ -1,26 +1,26 @@ -import smtplib -from email.mime.multipart import MIMEMultipart -from email.mime.text import MIMEText - -fro_add = "dilipvijjapu@gmail.com" -to_add = "vijjapudilip@gmail.com" - -message = MIMEMultipart() -message["From"] = fro_add -message["To"] = ",".join(to_add) -message["subject"] = "Testinf mail" - -body = "Hai this is dilip ,How are you" - -message.attach(MIMEText(body, "plain")) - -email = " " -password = " " - -mail = smtplib.SMTP("smtp.gmail.com", 587) -mail.ehlo() -mail.starttls() -mail.login(email, password) -text = message.as_string() -mail.sendmail(fro_add, to_add, text) -mail.quit() +import smtplib +from email.mime.multipart import MIMEMultipart +from email.mime.text import MIMEText + +fro_add = "dilipvijjapu@gmail.com" +to_add = "vijjapudilip@gmail.com" + +message = MIMEMultipart() +message["From"] = fro_add +message["To"] = ",".join(to_add) +message["subject"] = "Testinf mail" + +body = "Hai this is dilip ,How are you" + +message.attach(MIMEText(body, "plain")) + +email = " " +password = " " + +mail = smtplib.SMTP("smtp.gmail.com", 587) +mail.ehlo() +mail.starttls() +mail.login(email, password) +text = message.as_string() +mail.sendmail(fro_add, to_add, text) +mail.quit() diff --git a/email id dictionary/README.md b/email_id_dictionary/README.md similarity index 100% rename from email id dictionary/README.md rename to email_id_dictionary/README.md diff --git a/email id dictionary/dict1.py b/email_id_dictionary/dict1.py similarity index 100% rename from email id dictionary/dict1.py rename to email_id_dictionary/dict1.py diff --git a/email id dictionary/mbox-short.txt b/email_id_dictionary/mbox-short.txt similarity index 100% rename from email id dictionary/mbox-short.txt rename to email_id_dictionary/mbox-short.txt diff --git a/Emoji Dictionary/Images/1.jpg b/emoji_dictionary/Images/1.jpg similarity index 100% rename from Emoji Dictionary/Images/1.jpg rename to emoji_dictionary/Images/1.jpg diff --git a/Emoji Dictionary/Images/2.jpg b/emoji_dictionary/Images/2.jpg similarity index 100% rename from Emoji Dictionary/Images/2.jpg rename to emoji_dictionary/Images/2.jpg diff --git a/Emoji Dictionary/Images/3.jpg b/emoji_dictionary/Images/3.jpg similarity index 100% rename from Emoji Dictionary/Images/3.jpg rename to emoji_dictionary/Images/3.jpg diff --git a/Emoji Dictionary/Images/4.jpg b/emoji_dictionary/Images/4.jpg similarity index 100% rename from Emoji Dictionary/Images/4.jpg rename to emoji_dictionary/Images/4.jpg diff --git a/Emoji Dictionary/Images/5.jpg b/emoji_dictionary/Images/5.jpg similarity index 100% rename from Emoji Dictionary/Images/5.jpg rename to emoji_dictionary/Images/5.jpg diff --git a/Emoji Dictionary/Images/6.jpg b/emoji_dictionary/Images/6.jpg similarity index 100% rename from Emoji Dictionary/Images/6.jpg rename to emoji_dictionary/Images/6.jpg diff --git a/Emoji Dictionary/Images/7.jpg b/emoji_dictionary/Images/7.jpg similarity index 100% rename from Emoji Dictionary/Images/7.jpg rename to emoji_dictionary/Images/7.jpg diff --git a/Emoji Dictionary/Images/8.jpg b/emoji_dictionary/Images/8.jpg similarity index 100% rename from Emoji Dictionary/Images/8.jpg rename to emoji_dictionary/Images/8.jpg diff --git a/Emoji Dictionary/Images/9.jpg b/emoji_dictionary/Images/9.jpg similarity index 100% rename from Emoji Dictionary/Images/9.jpg rename to emoji_dictionary/Images/9.jpg diff --git a/Emoji Dictionary/README.md b/emoji_dictionary/README.md similarity index 100% rename from Emoji Dictionary/README.md rename to emoji_dictionary/README.md diff --git a/Emoji Dictionary/emoji_dictionary.py b/emoji_dictionary/emoji_dictionary.py similarity index 100% rename from Emoji Dictionary/emoji_dictionary.py rename to emoji_dictionary/emoji_dictionary.py diff --git a/Emoji Dictionary/requirements.txt b/emoji_dictionary/requirements.txt similarity index 100% rename from Emoji Dictionary/requirements.txt rename to emoji_dictionary/requirements.txt diff --git a/Encryption using base64.py b/encryption_using_base64.py similarity index 100% rename from Encryption using base64.py rename to encryption_using_base64.py diff --git a/EncryptionTool.py b/encryptiontool_1.py similarity index 100% rename from EncryptionTool.py rename to encryptiontool_1.py diff --git a/even and odd.py b/even_and_odd.py similarity index 100% rename from even and odd.py rename to even_and_odd.py diff --git a/Exception_Handling_in_Python.py b/exception_handling_in_python_1.py similarity index 100% rename from Exception_Handling_in_Python.py rename to exception_handling_in_python_1.py diff --git a/Extract-Table-from-pdf-txt-docx/Parent/Child1/Document_Child1.docx b/extract-table-from-pdf-txt-docx_1/Parent/Child1/Document_Child1.docx similarity index 100% rename from Extract-Table-from-pdf-txt-docx/Parent/Child1/Document_Child1.docx rename to extract-table-from-pdf-txt-docx_1/Parent/Child1/Document_Child1.docx diff --git a/Extract-Table-from-pdf-txt-docx/Parent/Child1/Pdf1_Child1.pdf b/extract-table-from-pdf-txt-docx_1/Parent/Child1/Pdf1_Child1.pdf similarity index 100% rename from Extract-Table-from-pdf-txt-docx/Parent/Child1/Pdf1_Child1.pdf rename to extract-table-from-pdf-txt-docx_1/Parent/Child1/Pdf1_Child1.pdf diff --git a/Extract-Table-from-pdf-txt-docx/Parent/Child1/Pdf2_Child2.pdf b/extract-table-from-pdf-txt-docx_1/Parent/Child1/Pdf2_Child2.pdf similarity index 100% rename from Extract-Table-from-pdf-txt-docx/Parent/Child1/Pdf2_Child2.pdf rename to extract-table-from-pdf-txt-docx_1/Parent/Child1/Pdf2_Child2.pdf diff --git a/Extract-Table-from-pdf-txt-docx/Parent/Child1/Text_Child1.txt b/extract-table-from-pdf-txt-docx_1/Parent/Child1/Text_Child1.txt similarity index 100% rename from Extract-Table-from-pdf-txt-docx/Parent/Child1/Text_Child1.txt rename to extract-table-from-pdf-txt-docx_1/Parent/Child1/Text_Child1.txt diff --git a/Extract-Table-from-pdf-txt-docx/Parent/Child2/Document_Child2.docx b/extract-table-from-pdf-txt-docx_1/Parent/Child2/Document_Child2.docx similarity index 100% rename from Extract-Table-from-pdf-txt-docx/Parent/Child2/Document_Child2.docx rename to extract-table-from-pdf-txt-docx_1/Parent/Child2/Document_Child2.docx diff --git a/Extract-Table-from-pdf-txt-docx/Parent/Child2/Pdf1_Child2.pdf b/extract-table-from-pdf-txt-docx_1/Parent/Child2/Pdf1_Child2.pdf similarity index 100% rename from Extract-Table-from-pdf-txt-docx/Parent/Child2/Pdf1_Child2.pdf rename to extract-table-from-pdf-txt-docx_1/Parent/Child2/Pdf1_Child2.pdf diff --git a/Extract-Table-from-pdf-txt-docx/Parent/Child2/Pdf2_Child2.pdf b/extract-table-from-pdf-txt-docx_1/Parent/Child2/Pdf2_Child2.pdf similarity index 100% rename from Extract-Table-from-pdf-txt-docx/Parent/Child2/Pdf2_Child2.pdf rename to extract-table-from-pdf-txt-docx_1/Parent/Child2/Pdf2_Child2.pdf diff --git a/Extract-Table-from-pdf-txt-docx/Parent/Child2/Text_Child2.txt b/extract-table-from-pdf-txt-docx_1/Parent/Child2/Text_Child2.txt similarity index 100% rename from Extract-Table-from-pdf-txt-docx/Parent/Child2/Text_Child2.txt rename to extract-table-from-pdf-txt-docx_1/Parent/Child2/Text_Child2.txt diff --git a/Extract-Table-from-pdf-txt-docx/Parent/Child3/Document_Child3.docx b/extract-table-from-pdf-txt-docx_1/Parent/Child3/Document_Child3.docx similarity index 100% rename from Extract-Table-from-pdf-txt-docx/Parent/Child3/Document_Child3.docx rename to extract-table-from-pdf-txt-docx_1/Parent/Child3/Document_Child3.docx diff --git a/Extract-Table-from-pdf-txt-docx/Parent/Child3/Pdf1_Child3.pdf b/extract-table-from-pdf-txt-docx_1/Parent/Child3/Pdf1_Child3.pdf similarity index 100% rename from Extract-Table-from-pdf-txt-docx/Parent/Child3/Pdf1_Child3.pdf rename to extract-table-from-pdf-txt-docx_1/Parent/Child3/Pdf1_Child3.pdf diff --git a/Extract-Table-from-pdf-txt-docx/Parent/Child3/Pdf2_Child3.pdf b/extract-table-from-pdf-txt-docx_1/Parent/Child3/Pdf2_Child3.pdf similarity index 100% rename from Extract-Table-from-pdf-txt-docx/Parent/Child3/Pdf2_Child3.pdf rename to extract-table-from-pdf-txt-docx_1/Parent/Child3/Pdf2_Child3.pdf diff --git a/Extract-Table-from-pdf-txt-docx/Parent/Child3/Text_Child3.txt b/extract-table-from-pdf-txt-docx_1/Parent/Child3/Text_Child3.txt similarity index 100% rename from Extract-Table-from-pdf-txt-docx/Parent/Child3/Text_Child3.txt rename to extract-table-from-pdf-txt-docx_1/Parent/Child3/Text_Child3.txt diff --git a/Extract-Table-from-pdf-txt-docx/main.py b/extract-table-from-pdf-txt-docx_1/main.py similarity index 100% rename from Extract-Table-from-pdf-txt-docx/main.py rename to extract-table-from-pdf-txt-docx_1/main.py diff --git a/Extract_Text_from_image.py b/extract_text_from_image_1.py similarity index 100% rename from Extract_Text_from_image.py rename to extract_text_from_image_1.py diff --git a/Face and eye Recognition/face_recofnation_first.py b/face_and_eye_recognition/face_recofnation_first.py similarity index 100% rename from Face and eye Recognition/face_recofnation_first.py rename to face_and_eye_recognition/face_recofnation_first.py diff --git a/Face and eye Recognition/gesture_control.py b/face_and_eye_recognition/gesture_control.py similarity index 100% rename from Face and eye Recognition/gesture_control.py rename to face_and_eye_recognition/gesture_control.py diff --git a/Face_Mask_detection (haarcascade)/Resources/haarcascade_frontalface_default.xml b/face_mask_detection_(haarcascade)/Resources/haarcascade_frontalface_default.xml similarity index 100% rename from Face_Mask_detection (haarcascade)/Resources/haarcascade_frontalface_default.xml rename to face_mask_detection_(haarcascade)/Resources/haarcascade_frontalface_default.xml diff --git a/Face_Mask_detection (haarcascade)/Resources/keras_model.h5 b/face_mask_detection_(haarcascade)/Resources/keras_model.h5 similarity index 100% rename from Face_Mask_detection (haarcascade)/Resources/keras_model.h5 rename to face_mask_detection_(haarcascade)/Resources/keras_model.h5 diff --git a/Face_Mask_detection (haarcascade)/mask_detection.py b/face_mask_detection_(haarcascade)/mask_detection.py similarity index 100% rename from Face_Mask_detection (haarcascade)/mask_detection.py rename to face_mask_detection_(haarcascade)/mask_detection.py diff --git a/facebook id hack.py b/facebook_id_hack.py similarity index 100% rename from facebook id hack.py rename to facebook_id_hack.py diff --git a/Fibonacci_sequence_recursive_sol.py b/fibonacci_sequence_recursive_sol_1.py similarity index 100% rename from Fibonacci_sequence_recursive_sol.py rename to fibonacci_sequence_recursive_sol_1.py diff --git a/FibonacciNumbersWithGenerators.py b/fibonaccinumberswithgenerators_1.py similarity index 100% rename from FibonacciNumbersWithGenerators.py rename to fibonaccinumberswithgenerators_1.py diff --git a/fibonici series.py b/fibonici_series.py similarity index 100% rename from fibonici series.py rename to fibonici_series.py diff --git a/Find current weather of any city using openweathermap API.py b/find_current_weather_of_any_city_using_openweathermap_api.py similarity index 100% rename from Find current weather of any city using openweathermap API.py rename to find_current_weather_of_any_city_using_openweathermap_api.py diff --git a/FIND FACTORIAL OF A NUMBER.py b/find_factorial_of_a_number.py similarity index 100% rename from FIND FACTORIAL OF A NUMBER.py rename to find_factorial_of_a_number.py diff --git a/finding LCM.py b/finding_lcm.py similarity index 100% rename from finding LCM.py rename to finding_lcm.py diff --git a/FindingResolutionOfAnImage.py b/findingresolutionofanimage_1.py similarity index 100% rename from FindingResolutionOfAnImage.py rename to findingresolutionofanimage_1.py diff --git a/FizzBuzz.py b/fizzbuzz_1.py similarity index 100% rename from FizzBuzz.py rename to fizzbuzz_1.py diff --git a/Flappy Bird - created with tkinter/.gitignore b/flappy_bird_-_created_with_tkinter/.gitignore similarity index 100% rename from Flappy Bird - created with tkinter/.gitignore rename to flappy_bird_-_created_with_tkinter/.gitignore diff --git a/Flappy Bird - created with tkinter/Background.py b/flappy_bird_-_created_with_tkinter/Background.py similarity index 100% rename from Flappy Bird - created with tkinter/Background.py rename to flappy_bird_-_created_with_tkinter/Background.py diff --git a/Flappy Bird - created with tkinter/Bird.py b/flappy_bird_-_created_with_tkinter/Bird.py similarity index 100% rename from Flappy Bird - created with tkinter/Bird.py rename to flappy_bird_-_created_with_tkinter/Bird.py diff --git a/Flappy Bird - created with tkinter/Flappy Bird.py b/flappy_bird_-_created_with_tkinter/Flappy Bird.py similarity index 100% rename from Flappy Bird - created with tkinter/Flappy Bird.py rename to flappy_bird_-_created_with_tkinter/Flappy Bird.py diff --git a/Flappy Bird - created with tkinter/Images/background.png b/flappy_bird_-_created_with_tkinter/Images/background.png similarity index 100% rename from Flappy Bird - created with tkinter/Images/background.png rename to flappy_bird_-_created_with_tkinter/Images/background.png diff --git a/Flappy Bird - created with tkinter/Images/bird.png b/flappy_bird_-_created_with_tkinter/Images/bird.png similarity index 100% rename from Flappy Bird - created with tkinter/Images/bird.png rename to flappy_bird_-_created_with_tkinter/Images/bird.png diff --git a/Flappy Bird - created with tkinter/Images/exit_button.png b/flappy_bird_-_created_with_tkinter/Images/exit_button.png similarity index 100% rename from Flappy Bird - created with tkinter/Images/exit_button.png rename to flappy_bird_-_created_with_tkinter/Images/exit_button.png diff --git a/Flappy Bird - created with tkinter/Images/original_background.png b/flappy_bird_-_created_with_tkinter/Images/original_background.png similarity index 100% rename from Flappy Bird - created with tkinter/Images/original_background.png rename to flappy_bird_-_created_with_tkinter/Images/original_background.png diff --git a/Flappy Bird - created with tkinter/Images/scoreboard.png b/flappy_bird_-_created_with_tkinter/Images/scoreboard.png similarity index 100% rename from Flappy Bird - created with tkinter/Images/scoreboard.png rename to flappy_bird_-_created_with_tkinter/Images/scoreboard.png diff --git a/Flappy Bird - created with tkinter/Images/start_button.png b/flappy_bird_-_created_with_tkinter/Images/start_button.png similarity index 100% rename from Flappy Bird - created with tkinter/Images/start_button.png rename to flappy_bird_-_created_with_tkinter/Images/start_button.png diff --git a/Flappy Bird - created with tkinter/Images/title.png b/flappy_bird_-_created_with_tkinter/Images/title.png similarity index 100% rename from Flappy Bird - created with tkinter/Images/title.png rename to flappy_bird_-_created_with_tkinter/Images/title.png diff --git a/Flappy Bird - created with tkinter/Images/tube.png b/flappy_bird_-_created_with_tkinter/Images/tube.png similarity index 100% rename from Flappy Bird - created with tkinter/Images/tube.png rename to flappy_bird_-_created_with_tkinter/Images/tube.png diff --git a/Flappy Bird - created with tkinter/Images/tube_mouth.png b/flappy_bird_-_created_with_tkinter/Images/tube_mouth.png similarity index 100% rename from Flappy Bird - created with tkinter/Images/tube_mouth.png rename to flappy_bird_-_created_with_tkinter/Images/tube_mouth.png diff --git a/Flappy Bird - created with tkinter/README.md b/flappy_bird_-_created_with_tkinter/README.md similarity index 100% rename from Flappy Bird - created with tkinter/README.md rename to flappy_bird_-_created_with_tkinter/README.md diff --git a/Flappy Bird - created with tkinter/Settings.py b/flappy_bird_-_created_with_tkinter/Settings.py similarity index 100% rename from Flappy Bird - created with tkinter/Settings.py rename to flappy_bird_-_created_with_tkinter/Settings.py diff --git a/Flappy Bird - created with tkinter/Tubes.py b/flappy_bird_-_created_with_tkinter/Tubes.py similarity index 100% rename from Flappy Bird - created with tkinter/Tubes.py rename to flappy_bird_-_created_with_tkinter/Tubes.py diff --git a/flappyBird_pygame/README.md b/flappybird_pygame_1/README.md similarity index 100% rename from flappyBird_pygame/README.md rename to flappybird_pygame_1/README.md diff --git a/flappyBird_pygame/flappy_bird.py b/flappybird_pygame_1/flappy_bird.py similarity index 96% rename from flappyBird_pygame/flappy_bird.py rename to flappybird_pygame_1/flappy_bird.py index 34b3206b7e2..b799c5b4725 100644 --- a/flappyBird_pygame/flappy_bird.py +++ b/flappybird_pygame_1/flappy_bird.py @@ -1,275 +1,275 @@ -#! /usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Created on Fri Mar 23 14:17:24 2019 - -@author: Mehul -""" - - -import math -import os -from collections import deque -from random import randint - -import pygame -from pygame.locals import * - -FPS = 60 -ANI_SPEED = 0.18 # pixels per millisecond -W_WIDTH = 284 * 2 # BG image size: 284x512 px; tiled twice -W_HEIGHT = 512 - - -class Bird(pygame.sprite.Sprite): - - WIDTH = 32 # bird image width - HEIGHT = 32 # bird image height - DOWN_SPEED = 0.18 # pix per ms -y - UP_SPEED = 0.3 # pix per ms +y - UP_DURATION = 150 # time for which bird go up - - def __init__(self, x, y, ms_to_up, images): - - super(Bird, self).__init__() - self.x, self.y = x, y - self.ms_to_up = ms_to_up - self._img_wingup, self._img_wingdown = images - self._mask_wingup = pygame.mask.from_surface(self._img_wingup) - self._mask_wingdown = pygame.mask.from_surface(self._img_wingdown) - - def update(self, delta_frames=1): - - if self.ms_to_up > 0: - frac_climb_done = 1 - self.ms_to_up / Bird.UP_DURATION - self.y -= ( - Bird.UP_SPEED - * frames_to_msec(delta_frames) - * (1 - math.cos(frac_climb_done * math.pi)) - ) - self.ms_to_up -= frames_to_msec(delta_frames) - else: - self.y += Bird.DOWN_SPEED * frames_to_msec(delta_frames) - - @property - def image(self): - # to animate bird - if pygame.time.get_ticks() % 500 >= 250: - return self._img_wingup - else: - return self._img_wingdown - - @property - def mask(self): - # collision detection - if pygame.time.get_ticks() % 500 >= 250: - return self._mask_wingup - else: - return self._mask_wingdown - - @property - def rect(self): - # return birds params - return Rect(self.x, self.y, Bird.WIDTH, Bird.HEIGHT) - - -class PipePair(pygame.sprite.Sprite): - - WIDTH = 80 # width of pipe - PIECE_HEIGHT = 32 - ADD_INTERVAL = 3000 - - def __init__(self, pipe_end_img, pipe_body_img): - - self.x = float(W_WIDTH - 1) - self.score_counted = False - - self.image = pygame.Surface((PipePair.WIDTH, W_HEIGHT), SRCALPHA) - self.image.convert() # speeds up blitting - self.image.fill((0, 0, 0, 0)) - total_pipe_body_pieces = int( - ( - W_HEIGHT - - 3 * Bird.HEIGHT # fill window from top to bottom - - 3 * PipePair.PIECE_HEIGHT # make room for bird to fit through - ) - / PipePair.PIECE_HEIGHT # 2 end pieces + 1 body piece # to get number of pipe pieces - ) - self.bottom_pieces = randint(1, total_pipe_body_pieces) - self.top_pieces = total_pipe_body_pieces - self.bottom_pieces - - # bottom pipe - for i in range(1, self.bottom_pieces + 1): - piece_pos = (0, W_HEIGHT - i * PipePair.PIECE_HEIGHT) - self.image.blit(pipe_body_img, piece_pos) - bottom_pipe_end_y = W_HEIGHT - self.bottom_height_px - bottom_end_piece_pos = (0, bottom_pipe_end_y - PipePair.PIECE_HEIGHT) - self.image.blit(pipe_end_img, bottom_end_piece_pos) - - # top pipe - for i in range(self.top_pieces): - self.image.blit(pipe_body_img, (0, i * PipePair.PIECE_HEIGHT)) - top_pipe_end_y = self.top_height_px - self.image.blit(pipe_end_img, (0, top_pipe_end_y)) - - # compensate for added end pieces - self.top_pieces += 1 - self.bottom_pieces += 1 - - # for collision detection - self.mask = pygame.mask.from_surface(self.image) - - @property - def top_height_px(self): - # returns top pipe's height in pix - return self.top_pieces * PipePair.PIECE_HEIGHT - - @property - def bottom_height_px(self): - - return self.bottom_pieces * PipePair.PIECE_HEIGHT - - @property - def visible(self): - # pipe is on screen or not - return -PipePair.WIDTH < self.x < W_WIDTH - - @property - def rect(self): - # Get the Rect which contains this Pipe. - return Rect(self.x, 0, PipePair.WIDTH, PipePair.PIECE_HEIGHT) - - def update(self, delta_frames=1): - - self.x -= ANI_SPEED * frames_to_msec(delta_frames) - - def collides_with(self, bird): - - return pygame.sprite.collide_mask(self, bird) - - -def load_images(): - def load_image(img_file_name): - - file_name = os.path.join(".", "images", img_file_name) - img = pygame.image.load(file_name) - img.convert() - return img - - return { - "background": load_image("background.png"), - "pipe-end": load_image("pipe_end.png"), - "pipe-body": load_image("pipe_body.png"), - # images for animating the flapping bird -- animated GIFs are - # not supported in pygame - "bird-wingup": load_image("bird_wing_up.png"), - "bird-wingdown": load_image("bird_wing_down.png"), - } - - -def frames_to_msec(frames, fps=FPS): - - return 1000.0 * frames / fps - - -def msec_to_frames(milliseconds, fps=FPS): - - return fps * milliseconds / 1000.0 - - -""" -def gameover(display, score): - font = pygame.font.SysFont(None,55) - text = font.render("Game Over! Score: {}".format(score),True,(255,0,0)) - display.blit(text, [150,250])""" - - -def main(): - - pygame.init() - - display_surface = pygame.display.set_mode((W_WIDTH, W_HEIGHT)) - pygame.display.set_caption("Flappy Bird by PMN") - - clock = pygame.time.Clock() - score_font = pygame.font.SysFont(None, 32, bold=True) # default font - images = load_images() - - # the bird stays in the same x position, so bird.x is a constant - # center bird on screen - bird = Bird( - 50, - int(W_HEIGHT / 2 - Bird.HEIGHT / 2), - 2, - (images["bird-wingup"], images["bird-wingdown"]), - ) - - pipes = deque() - - frame_clock = 0 # this counter is only incremented if the game isn't paused - score = 0 - done = paused = False - while not done: - clock.tick(FPS) - - # Handle this 'manually'. If we used pygame.time.set_timer(), - # pipe addition would be messed up when paused. - if not (paused or frame_clock % msec_to_frames(PipePair.ADD_INTERVAL)): - pp = PipePair(images["pipe-end"], images["pipe-body"]) - pipes.append(pp) - - for e in pygame.event.get(): - if e.type == QUIT or (e.type == KEYUP and e.key == K_ESCAPE): - done = True - break - elif e.type == KEYUP and e.key in (K_PAUSE, K_p): - paused = not paused - elif e.type == MOUSEBUTTONUP or ( - e.type == KEYUP and e.key in (K_UP, K_RETURN, K_SPACE) - ): - bird.ms_to_up = Bird.UP_DURATION - - if paused: - continue # don't draw anything - - # check for collisions - pipe_collision = any(p.collides_with(bird) for p in pipes) - if pipe_collision or 0 >= bird.y or bird.y >= W_HEIGHT - Bird.HEIGHT: - done = True - - for x in (0, W_WIDTH / 2): - display_surface.blit(images["background"], (x, 0)) - - while pipes and not pipes[0].visible: - pipes.popleft() - - for p in pipes: - p.update() - display_surface.blit(p.image, p.rect) - - bird.update() - display_surface.blit(bird.image, bird.rect) - - # update and display score - for p in pipes: - if p.x + PipePair.WIDTH < bird.x and not p.score_counted: - score += 1 - p.score_counted = True - - score_surface = score_font.render(str(score), True, (255, 255, 255)) - score_x = W_WIDTH / 2 - score_surface.get_width() / 2 - display_surface.blit(score_surface, (score_x, PipePair.PIECE_HEIGHT)) - - pygame.display.flip() - frame_clock += 1 - # gameover(display_surface, score) - - print("Game over! Score: %i" % score) - - pygame.quit() - - -if __name__ == "__main__": - # If this module had been imported, __name__ would be 'flappybird'. - # It was executed (e.g. by double-clicking the file), so call main. - main() +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Created on Fri Mar 23 14:17:24 2019 + +@author: Mehul +""" + + +import math +import os +from collections import deque +from random import randint + +import pygame +from pygame.locals import * + +FPS = 60 +ANI_SPEED = 0.18 # pixels per millisecond +W_WIDTH = 284 * 2 # BG image size: 284x512 px; tiled twice +W_HEIGHT = 512 + + +class Bird(pygame.sprite.Sprite): + + WIDTH = 32 # bird image width + HEIGHT = 32 # bird image height + DOWN_SPEED = 0.18 # pix per ms -y + UP_SPEED = 0.3 # pix per ms +y + UP_DURATION = 150 # time for which bird go up + + def __init__(self, x, y, ms_to_up, images): + + super(Bird, self).__init__() + self.x, self.y = x, y + self.ms_to_up = ms_to_up + self._img_wingup, self._img_wingdown = images + self._mask_wingup = pygame.mask.from_surface(self._img_wingup) + self._mask_wingdown = pygame.mask.from_surface(self._img_wingdown) + + def update(self, delta_frames=1): + + if self.ms_to_up > 0: + frac_climb_done = 1 - self.ms_to_up / Bird.UP_DURATION + self.y -= ( + Bird.UP_SPEED + * frames_to_msec(delta_frames) + * (1 - math.cos(frac_climb_done * math.pi)) + ) + self.ms_to_up -= frames_to_msec(delta_frames) + else: + self.y += Bird.DOWN_SPEED * frames_to_msec(delta_frames) + + @property + def image(self): + # to animate bird + if pygame.time.get_ticks() % 500 >= 250: + return self._img_wingup + else: + return self._img_wingdown + + @property + def mask(self): + # collision detection + if pygame.time.get_ticks() % 500 >= 250: + return self._mask_wingup + else: + return self._mask_wingdown + + @property + def rect(self): + # return birds params + return Rect(self.x, self.y, Bird.WIDTH, Bird.HEIGHT) + + +class PipePair(pygame.sprite.Sprite): + + WIDTH = 80 # width of pipe + PIECE_HEIGHT = 32 + ADD_INTERVAL = 3000 + + def __init__(self, pipe_end_img, pipe_body_img): + + self.x = float(W_WIDTH - 1) + self.score_counted = False + + self.image = pygame.Surface((PipePair.WIDTH, W_HEIGHT), SRCALPHA) + self.image.convert() # speeds up blitting + self.image.fill((0, 0, 0, 0)) + total_pipe_body_pieces = int( + ( + W_HEIGHT + - 3 * Bird.HEIGHT # fill window from top to bottom + - 3 * PipePair.PIECE_HEIGHT # make room for bird to fit through + ) + / PipePair.PIECE_HEIGHT # 2 end pieces + 1 body piece # to get number of pipe pieces + ) + self.bottom_pieces = randint(1, total_pipe_body_pieces) + self.top_pieces = total_pipe_body_pieces - self.bottom_pieces + + # bottom pipe + for i in range(1, self.bottom_pieces + 1): + piece_pos = (0, W_HEIGHT - i * PipePair.PIECE_HEIGHT) + self.image.blit(pipe_body_img, piece_pos) + bottom_pipe_end_y = W_HEIGHT - self.bottom_height_px + bottom_end_piece_pos = (0, bottom_pipe_end_y - PipePair.PIECE_HEIGHT) + self.image.blit(pipe_end_img, bottom_end_piece_pos) + + # top pipe + for i in range(self.top_pieces): + self.image.blit(pipe_body_img, (0, i * PipePair.PIECE_HEIGHT)) + top_pipe_end_y = self.top_height_px + self.image.blit(pipe_end_img, (0, top_pipe_end_y)) + + # compensate for added end pieces + self.top_pieces += 1 + self.bottom_pieces += 1 + + # for collision detection + self.mask = pygame.mask.from_surface(self.image) + + @property + def top_height_px(self): + # returns top pipe's height in pix + return self.top_pieces * PipePair.PIECE_HEIGHT + + @property + def bottom_height_px(self): + + return self.bottom_pieces * PipePair.PIECE_HEIGHT + + @property + def visible(self): + # pipe is on screen or not + return -PipePair.WIDTH < self.x < W_WIDTH + + @property + def rect(self): + # Get the Rect which contains this Pipe. + return Rect(self.x, 0, PipePair.WIDTH, PipePair.PIECE_HEIGHT) + + def update(self, delta_frames=1): + + self.x -= ANI_SPEED * frames_to_msec(delta_frames) + + def collides_with(self, bird): + + return pygame.sprite.collide_mask(self, bird) + + +def load_images(): + def load_image(img_file_name): + + file_name = os.path.join(".", "images", img_file_name) + img = pygame.image.load(file_name) + img.convert() + return img + + return { + "background": load_image("background.png"), + "pipe-end": load_image("pipe_end.png"), + "pipe-body": load_image("pipe_body.png"), + # images for animating the flapping bird -- animated GIFs are + # not supported in pygame + "bird-wingup": load_image("bird_wing_up.png"), + "bird-wingdown": load_image("bird_wing_down.png"), + } + + +def frames_to_msec(frames, fps=FPS): + + return 1000.0 * frames / fps + + +def msec_to_frames(milliseconds, fps=FPS): + + return fps * milliseconds / 1000.0 + + +""" +def gameover(display, score): + font = pygame.font.SysFont(None,55) + text = font.render("Game Over! Score: {}".format(score),True,(255,0,0)) + display.blit(text, [150,250])""" + + +def main(): + + pygame.init() + + display_surface = pygame.display.set_mode((W_WIDTH, W_HEIGHT)) + pygame.display.set_caption("Flappy Bird by PMN") + + clock = pygame.time.Clock() + score_font = pygame.font.SysFont(None, 32, bold=True) # default font + images = load_images() + + # the bird stays in the same x position, so bird.x is a constant + # center bird on screen + bird = Bird( + 50, + int(W_HEIGHT / 2 - Bird.HEIGHT / 2), + 2, + (images["bird-wingup"], images["bird-wingdown"]), + ) + + pipes = deque() + + frame_clock = 0 # this counter is only incremented if the game isn't paused + score = 0 + done = paused = False + while not done: + clock.tick(FPS) + + # Handle this 'manually'. If we used pygame.time.set_timer(), + # pipe addition would be messed up when paused. + if not (paused or frame_clock % msec_to_frames(PipePair.ADD_INTERVAL)): + pp = PipePair(images["pipe-end"], images["pipe-body"]) + pipes.append(pp) + + for e in pygame.event.get(): + if e.type == QUIT or (e.type == KEYUP and e.key == K_ESCAPE): + done = True + break + elif e.type == KEYUP and e.key in (K_PAUSE, K_p): + paused = not paused + elif e.type == MOUSEBUTTONUP or ( + e.type == KEYUP and e.key in (K_UP, K_RETURN, K_SPACE) + ): + bird.ms_to_up = Bird.UP_DURATION + + if paused: + continue # don't draw anything + + # check for collisions + pipe_collision = any(p.collides_with(bird) for p in pipes) + if pipe_collision or 0 >= bird.y or bird.y >= W_HEIGHT - Bird.HEIGHT: + done = True + + for x in (0, W_WIDTH / 2): + display_surface.blit(images["background"], (x, 0)) + + while pipes and not pipes[0].visible: + pipes.popleft() + + for p in pipes: + p.update() + display_surface.blit(p.image, p.rect) + + bird.update() + display_surface.blit(bird.image, bird.rect) + + # update and display score + for p in pipes: + if p.x + PipePair.WIDTH < bird.x and not p.score_counted: + score += 1 + p.score_counted = True + + score_surface = score_font.render(str(score), True, (255, 255, 255)) + score_x = W_WIDTH / 2 - score_surface.get_width() / 2 + display_surface.blit(score_surface, (score_x, PipePair.PIECE_HEIGHT)) + + pygame.display.flip() + frame_clock += 1 + # gameover(display_surface, score) + + print("Game over! Score: %i" % score) + + pygame.quit() + + +if __name__ == "__main__": + # If this module had been imported, __name__ would be 'flappybird'. + # It was executed (e.g. by double-clicking the file), so call main. + main() diff --git a/flappyBird_pygame/images/background.png b/flappybird_pygame_1/images/background.png similarity index 100% rename from flappyBird_pygame/images/background.png rename to flappybird_pygame_1/images/background.png diff --git a/flappyBird_pygame/images/bird.gif b/flappybird_pygame_1/images/bird.gif similarity index 100% rename from flappyBird_pygame/images/bird.gif rename to flappybird_pygame_1/images/bird.gif diff --git a/flappyBird_pygame/images/bird_wing_down.png b/flappybird_pygame_1/images/bird_wing_down.png similarity index 100% rename from flappyBird_pygame/images/bird_wing_down.png rename to flappybird_pygame_1/images/bird_wing_down.png diff --git a/flappyBird_pygame/images/bird_wing_up.png b/flappybird_pygame_1/images/bird_wing_up.png similarity index 100% rename from flappyBird_pygame/images/bird_wing_up.png rename to flappybird_pygame_1/images/bird_wing_up.png diff --git a/flappyBird_pygame/images/ground.png b/flappybird_pygame_1/images/ground.png similarity index 100% rename from flappyBird_pygame/images/ground.png rename to flappybird_pygame_1/images/ground.png diff --git a/flappyBird_pygame/images/pipe.png b/flappybird_pygame_1/images/pipe.png similarity index 100% rename from flappyBird_pygame/images/pipe.png rename to flappybird_pygame_1/images/pipe.png diff --git a/flappyBird_pygame/images/pipe_body.png b/flappybird_pygame_1/images/pipe_body.png similarity index 100% rename from flappyBird_pygame/images/pipe_body.png rename to flappybird_pygame_1/images/pipe_body.png diff --git a/flappyBird_pygame/images/pipe_end.png b/flappybird_pygame_1/images/pipe_end.png similarity index 100% rename from flappyBird_pygame/images/pipe_end.png rename to flappybird_pygame_1/images/pipe_end.png diff --git a/FTP in python b/ftp_in_python similarity index 100% rename from FTP in python rename to ftp_in_python diff --git a/Generate a random number between 0 to 9.py b/generate_a_random_number_between_0_to_9.py similarity index 100% rename from Generate a random number between 0 to 9.py rename to generate_a_random_number_between_0_to_9.py diff --git a/get_likes_on_FB.py b/get_likes_on_fb_1.py similarity index 100% rename from get_likes_on_FB.py rename to get_likes_on_fb_1.py diff --git a/Google_Image_Downloader/create_dir.py b/google_image_downloader_1/create_dir.py similarity index 100% rename from Google_Image_Downloader/create_dir.py rename to google_image_downloader_1/create_dir.py diff --git a/Google_Image_Downloader/image_grapper.py b/google_image_downloader_1/image_grapper.py similarity index 100% rename from Google_Image_Downloader/image_grapper.py rename to google_image_downloader_1/image_grapper.py diff --git a/Google_News.py b/google_news_1.py similarity index 100% rename from Google_News.py rename to google_news_1.py diff --git a/Gregorian_Calendar.py b/gregorian_calendar_1.py similarity index 100% rename from Gregorian_Calendar.py rename to gregorian_calendar_1.py diff --git a/Grocery calculator.py b/grocery_calculator.py similarity index 100% rename from Grocery calculator.py rename to grocery_calculator.py diff --git a/GroupSms_Way2.py b/groupsms_way2_1.py similarity index 100% rename from GroupSms_Way2.py rename to groupsms_way2_1.py diff --git a/Guess_the_number_game.py b/guess_the_number_game_1.py similarity index 100% rename from Guess_the_number_game.py rename to guess_the_number_game_1.py diff --git a/Guessing_Game.py b/guessing_game_1.py similarity index 100% rename from Guessing_Game.py rename to guessing_game_1.py diff --git a/Hand-Motion-Detection/hand_motion_recognizer.py b/hand-motion-detection_1/hand_motion_recognizer.py similarity index 100% rename from Hand-Motion-Detection/hand_motion_recognizer.py rename to hand-motion-detection_1/hand_motion_recognizer.py diff --git a/Hand-Motion-Detection/requirements.txt b/hand-motion-detection_1/requirements.txt similarity index 100% rename from Hand-Motion-Detection/requirements.txt rename to hand-motion-detection_1/requirements.txt diff --git a/Hangman.py b/hangman_1.py similarity index 100% rename from Hangman.py rename to hangman_1.py diff --git a/HangMan Game b/hangman_game similarity index 100% rename from HangMan Game rename to hangman_game diff --git a/Hotel-Management.py b/hotel-management_1.py similarity index 100% rename from Hotel-Management.py rename to hotel-management_1.py diff --git a/how to add three numbers and find type in python.py b/how_to_add_three_numbers_and_find_type_in_python.py similarity index 100% rename from how to add three numbers and find type in python.py rename to how_to_add_three_numbers_and_find_type_in_python.py diff --git a/Python Program to Print the Fibonacci sequence.py b/how_to_display_the_fibonacci_sequence_up_to_n-.py similarity index 100% rename from Python Program to Print the Fibonacci sequence.py rename to how_to_display_the_fibonacci_sequence_up_to_n-.py diff --git a/Image_resize.py b/image_resize_1.py similarity index 100% rename from Image_resize.py rename to image_resize_1.py diff --git a/ImageDownloader/img_downloader.py b/imagedownloader_1/img_downloader.py similarity index 100% rename from ImageDownloader/img_downloader.py rename to imagedownloader_1/img_downloader.py diff --git a/ImageDownloader/requirements.txt b/imagedownloader_1/requirements.txt similarity index 100% rename from ImageDownloader/requirements.txt rename to imagedownloader_1/requirements.txt diff --git a/Infix_to_Postfix.py b/infix_to_postfix_1.py similarity index 100% rename from Infix_to_Postfix.py rename to infix_to_postfix_1.py diff --git a/inheritance_YahV1729.python b/inheritance_yahv1729_1.python similarity index 100% rename from inheritance_YahV1729.python rename to inheritance_yahv1729_1.python diff --git a/input matrice,product any order!.py b/input_matrice,product_any_order!.py similarity index 95% rename from input matrice,product any order!.py rename to input_matrice,product_any_order!.py index d0e3223e4c4..f8d7f442cd9 100644 --- a/input matrice,product any order!.py +++ b/input_matrice,product_any_order!.py @@ -1,69 +1,69 @@ -# inputing 2 matrices: - -# matrice 1: - -rows = int(input("Enter the number of rows of the matrice 1")) -coloumns = int(input("Enter the coloumns of the matrice 1")) -matrice = [] -rowan = [] - -for i in range(0, rows): - for j in range(0, coloumns): - element = int(input("enter the element")) - rowan.append(element) - print("one row completed") - matrice.append(rowan) - rowan = [] - -print("matrice 1 is \n") -for ch in matrice: - print(ch) -A = matrice - -# matrice 2: - -rows_ = coloumns -coloumns_ = int(input("Enter the coloumns of the matrice 2")) -rowan = [] -matrix = [] - -for i in range(0, rows_): - for j in range(0, coloumns_): - element = int(input("enter the element")) - rowan.append(element) - print("one row completed") - matrix.append(rowan) - rowan = [] - -print("Matrice 2 is\n") -for ch in matrix: - print(ch) - -B = matrix - -# creating empty frame: - -result = [] -for i in range(0, rows): - for j in range(0, coloumns_): - rowan.append(0) - result.append(rowan) - rowan = [] -print("\n") -print("The frame work of result") -for ch in result: - print(ch) - - -# Multiplication of the two matrices: - -for i in range(len(A)): - for j in range(len(B[0])): - for k in range(len(B)): - result[i][j] += A[i][k] * B[k][j] - -print("\n") -print("The product of the 2 matrices is \n") - -for i in result: - print(i) +# inputing 2 matrices: + +# matrice 1: + +rows = int(input("Enter the number of rows of the matrice 1")) +coloumns = int(input("Enter the coloumns of the matrice 1")) +matrice = [] +rowan = [] + +for i in range(0, rows): + for j in range(0, coloumns): + element = int(input("enter the element")) + rowan.append(element) + print("one row completed") + matrice.append(rowan) + rowan = [] + +print("matrice 1 is \n") +for ch in matrice: + print(ch) +A = matrice + +# matrice 2: + +rows_ = coloumns +coloumns_ = int(input("Enter the coloumns of the matrice 2")) +rowan = [] +matrix = [] + +for i in range(0, rows_): + for j in range(0, coloumns_): + element = int(input("enter the element")) + rowan.append(element) + print("one row completed") + matrix.append(rowan) + rowan = [] + +print("Matrice 2 is\n") +for ch in matrix: + print(ch) + +B = matrix + +# creating empty frame: + +result = [] +for i in range(0, rows): + for j in range(0, coloumns_): + rowan.append(0) + result.append(rowan) + rowan = [] +print("\n") +print("The frame work of result") +for ch in result: + print(ch) + + +# Multiplication of the two matrices: + +for i in range(len(A)): + for j in range(len(B[0])): + for k in range(len(B)): + result[i][j] += A[i][k] * B[k][j] + +print("\n") +print("The product of the 2 matrices is \n") + +for i in result: + print(i) diff --git a/Insert_operation_on_Linked_List.py b/insert_operation_on_linked_list_1.py similarity index 96% rename from Insert_operation_on_Linked_List.py rename to insert_operation_on_linked_list_1.py index 279df9296d3..3d773ccd2e2 100644 --- a/Insert_operation_on_Linked_List.py +++ b/insert_operation_on_linked_list_1.py @@ -1,56 +1,56 @@ -class Node: - def __init__(self, data): - self.data = data - self.next = None - - -class Linked_List: - def __init__(self): - self.head = None - - def Insert_At_Beginning(self, new_data): - new_node = Node(new_data) - new_node.next = self.head - self.head = new_node - - def Insert_After(self, node, new_data): - if node is None: - return "Alert!, Node must be in Linked List" - new_node = Node(new_data) - new_node.next = node.next - node.next = new_node - - def Insert_At_End(self, new_data): - new_node = Node(new_data) - if self.head is None: - self.head = new_node - return - current = self.head - while current.next: - current = current.next - current.next = new_node - - def Display(self): - temp = self.head - while temp: - print(temp.data, "->", end=" ") - temp = temp.next - print("None") - - -if __name__ == "__main__": - L_list = Linked_List() - L_list.Insert_At_Beginning(1) - L_list.Display() - L_list.Insert_At_Beginning(2) - L_list.Display() - L_list.Insert_At_Beginning(3) - L_list.Display() - L_list.Insert_At_End(4) - L_list.Display() - L_list.Insert_At_End(5) - L_list.Display() - L_list.Insert_At_End(6) - L_list.Display() - L_list.Insert_After(L_list.head.next, 10) - L_list.Display() +class Node: + def __init__(self, data): + self.data = data + self.next = None + + +class Linked_List: + def __init__(self): + self.head = None + + def Insert_At_Beginning(self, new_data): + new_node = Node(new_data) + new_node.next = self.head + self.head = new_node + + def Insert_After(self, node, new_data): + if node is None: + return "Alert!, Node must be in Linked List" + new_node = Node(new_data) + new_node.next = node.next + node.next = new_node + + def Insert_At_End(self, new_data): + new_node = Node(new_data) + if self.head is None: + self.head = new_node + return + current = self.head + while current.next: + current = current.next + current.next = new_node + + def Display(self): + temp = self.head + while temp: + print(temp.data, "->", end=" ") + temp = temp.next + print("None") + + +if __name__ == "__main__": + L_list = Linked_List() + L_list.Insert_At_Beginning(1) + L_list.Display() + L_list.Insert_At_Beginning(2) + L_list.Display() + L_list.Insert_At_Beginning(3) + L_list.Display() + L_list.Insert_At_End(4) + L_list.Display() + L_list.Insert_At_End(5) + L_list.Display() + L_list.Insert_At_End(6) + L_list.Display() + L_list.Insert_After(L_list.head.next, 10) + L_list.Display() diff --git a/JARVIS/JARVIS.py b/jarvis_1/JARVIS.py similarity index 100% rename from JARVIS/JARVIS.py rename to jarvis_1/JARVIS.py diff --git a/JARVIS/README.md b/jarvis_1/README.md similarity index 100% rename from JARVIS/README.md rename to jarvis_1/README.md diff --git a/JARVIS/requirements.txt b/jarvis_1/requirements.txt similarity index 100% rename from JARVIS/requirements.txt rename to jarvis_1/requirements.txt diff --git a/Job_scheduling.py b/job_scheduling_1.py similarity index 100% rename from Job_scheduling.py rename to job_scheduling_1.py diff --git a/JsonParser.py b/jsonparser_1.py similarity index 100% rename from JsonParser.py rename to jsonparser_1.py diff --git a/JustDialScrapperGUI/Justdial Scrapper GUI.py b/justdialscrappergui_1/Justdial Scrapper GUI.py similarity index 100% rename from JustDialScrapperGUI/Justdial Scrapper GUI.py rename to justdialscrappergui_1/Justdial Scrapper GUI.py diff --git a/Key_Binding/key_binding.py b/key_binding_1/key_binding.py similarity index 100% rename from Key_Binding/key_binding.py rename to key_binding_1/key_binding.py diff --git a/Key_Binding/requirement.txt b/key_binding_1/requirement.txt similarity index 100% rename from Key_Binding/requirement.txt rename to key_binding_1/requirement.txt diff --git a/Kilometerstomile.py b/kilometerstomile_1.py similarity index 100% rename from Kilometerstomile.py rename to kilometerstomile_1.py diff --git a/Koch Curve/README.txt b/koch_curve/README.txt similarity index 98% rename from Koch Curve/README.txt rename to koch_curve/README.txt index ed93fc72c75..7b5cbac4103 100644 --- a/Koch Curve/README.txt +++ b/koch_curve/README.txt @@ -1,38 +1,38 @@ -The Koch snowflake (also known as the Koch curve, Koch star, or Koch island) is a mathematical curve and one of the earliest fractal curves -to have been described. It is based on the Koch curve, which appeared in a 1904 paper titled “On a continuous curve without tangents, -constructible from elementary geometry” by the Swedish mathematician Helge von Koch. - -How to construct one: - -Step 1: -Draw an equilateral triangle. You can draw it with a compass or protractor, or just eyeball it if you don't want to spend too much time draw -ing the snowflake. It's best if the length of the sides are divisible by 3, because of the nature of this fractal. This will become clear -in the next few steps. - -Step 2: -Divide each side in three equal parts. This is why it is handy to have the sides divisible by three. - -Step 3: -Draw an equilateral triangle on each middle part. Measure the length of the middle third to know the length of the sides of these new -triangles. - -Step 4: -Divide each outer side into thirds. You can see the 2nd generation of triangles covers a bit of the first. These three line segments -shouldn't be parted in three. - -Step 5: -Draw an equilateral triangle on each middle part. Note how you draw each next generation of parts that are one 3rd of the mast one. - -Step 6: -Repeat until you're satisfied with the amount of iterations. It will become harder and harder to accurately draw the new triangles, but -with a fine pencil and lots of patience you can reach the 8th iteration. The one shown in the picture is a Koch snowflake of the 4th -iteration. - -Step 7: -Decorate your snowflake how you like it. You can colour it, cut it out, draw more triangles on the inside, or just leave it the way it is. - - -Reference Links: -http://www.geeksforgeeks.org/koch-curve-koch-snowflake/ -https://www.wikihow.com/Draw-the-Koch-Snowflake +The Koch snowflake (also known as the Koch curve, Koch star, or Koch island) is a mathematical curve and one of the earliest fractal curves +to have been described. It is based on the Koch curve, which appeared in a 1904 paper titled “On a continuous curve without tangents, +constructible from elementary geometry” by the Swedish mathematician Helge von Koch. + +How to construct one: + +Step 1: +Draw an equilateral triangle. You can draw it with a compass or protractor, or just eyeball it if you don't want to spend too much time draw +ing the snowflake. It's best if the length of the sides are divisible by 3, because of the nature of this fractal. This will become clear +in the next few steps. + +Step 2: +Divide each side in three equal parts. This is why it is handy to have the sides divisible by three. + +Step 3: +Draw an equilateral triangle on each middle part. Measure the length of the middle third to know the length of the sides of these new +triangles. + +Step 4: +Divide each outer side into thirds. You can see the 2nd generation of triangles covers a bit of the first. These three line segments +shouldn't be parted in three. + +Step 5: +Draw an equilateral triangle on each middle part. Note how you draw each next generation of parts that are one 3rd of the mast one. + +Step 6: +Repeat until you're satisfied with the amount of iterations. It will become harder and harder to accurately draw the new triangles, but +with a fine pencil and lots of patience you can reach the 8th iteration. The one shown in the picture is a Koch snowflake of the 4th +iteration. + +Step 7: +Decorate your snowflake how you like it. You can colour it, cut it out, draw more triangles on the inside, or just leave it the way it is. + + +Reference Links: +http://www.geeksforgeeks.org/koch-curve-koch-snowflake/ +https://www.wikihow.com/Draw-the-Koch-Snowflake https://en.wikipedia.org/wiki/Koch_snowflake \ No newline at end of file diff --git a/Koch Curve/koch curve.py b/koch_curve/koch curve.py similarity index 96% rename from Koch Curve/koch curve.py rename to koch_curve/koch curve.py index 77b31cc22f5..90777073dd8 100644 --- a/Koch Curve/koch curve.py +++ b/koch_curve/koch curve.py @@ -1,36 +1,36 @@ -# importing the libraries -# turtle standard graphics library for python -import turtle - - -# function to create koch snowflake or koch curve -def snowflake(lengthSide, levels): - if levels == 0: - t.forward(lengthSide) - return - lengthSide /= 3.0 - snowflake(lengthSide, levels - 1) - t.left(60) - snowflake(lengthSide, levels - 1) - t.right(120) - snowflake(lengthSide, levels - 1) - t.left(60) - snowflake(lengthSide, levels - 1) - - -# main function -if __name__ == "__main__": - t = turtle.Pen() - t.speed(0) # defining the speed of the turtle - length = 300.0 # - t.penup() # Pull the pen up – no drawing when moving. - # Move the turtle backward by distance, opposite to the direction the turtle is headed. - # Do not change the turtle’s heading. - t.backward(length / 2.0) - t.pendown() - for i in range(3): - # Pull the pen down – drawing when moving. - snowflake(length, 4) - t.right(120) - # To control the closing windows of the turtle - # mainloop() +# importing the libraries +# turtle standard graphics library for python +import turtle + + +# function to create koch snowflake or koch curve +def snowflake(lengthSide, levels): + if levels == 0: + t.forward(lengthSide) + return + lengthSide /= 3.0 + snowflake(lengthSide, levels - 1) + t.left(60) + snowflake(lengthSide, levels - 1) + t.right(120) + snowflake(lengthSide, levels - 1) + t.left(60) + snowflake(lengthSide, levels - 1) + + +# main function +if __name__ == "__main__": + t = turtle.Pen() + t.speed(0) # defining the speed of the turtle + length = 300.0 # + t.penup() # Pull the pen up – no drawing when moving. + # Move the turtle backward by distance, opposite to the direction the turtle is headed. + # Do not change the turtle’s heading. + t.backward(length / 2.0) + t.pendown() + for i in range(3): + # Pull the pen down – drawing when moving. + snowflake(length, 4) + t.right(120) + # To control the closing windows of the turtle + # mainloop() diff --git a/Koch Curve/output_2.mp4 b/koch_curve/output_2.mp4 similarity index 100% rename from Koch Curve/output_2.mp4 rename to koch_curve/output_2.mp4 diff --git a/leap year.py b/leap_year.py similarity index 100% rename from leap year.py rename to leap_year.py diff --git a/Letter_Counter.py b/letter_counter_1.py similarity index 100% rename from Letter_Counter.py rename to letter_counter_1.py diff --git a/LETTER GUESSER b/letter_guesser similarity index 100% rename from LETTER GUESSER rename to letter_guesser diff --git a/LICENSE.md b/license_1.md similarity index 100% rename from LICENSE.md rename to license_1.md diff --git a/linear search.py b/linear_search_1.py similarity index 100% rename from linear search.py rename to linear_search_1.py diff --git a/List.py b/list_1.py similarity index 94% rename from List.py rename to list_1.py index bfc9b223f26..1851d9e1beb 100644 --- a/List.py +++ b/list_1.py @@ -1,35 +1,35 @@ -List = [] -# List is Muteable -# means value can be change -List.insert(0, 5) #insertion takes place at mentioned index -List.insert(1, 10) -List.insert(0, 6) -print(List) -List.remove(6) -List.append(9) #insertion takes place at last -List.append(1) -List.sort() #arranges element in ascending order -print(List) -List.pop() -List.reverse() -print(List) -""" -List.append(1) -print(List) -List.append(2) -print(List) -List.insert(1 , 3) -print(List) -""" - -list2 = [2, 3, 7, 5, 10, 17, 12, 4, 1, 13] -for i in list2: - if i % 2 == 0: - print(i) -""" -Expected Output: -2 -10 -12 -4 -""" +List = [] +# List is Muteable +# means value can be change +List.insert(0, 5) #insertion takes place at mentioned index +List.insert(1, 10) +List.insert(0, 6) +print(List) +List.remove(6) +List.append(9) #insertion takes place at last +List.append(1) +List.sort() #arranges element in ascending order +print(List) +List.pop() +List.reverse() +print(List) +""" +List.append(1) +print(List) +List.append(2) +print(List) +List.insert(1 , 3) +print(List) +""" + +list2 = [2, 3, 7, 5, 10, 17, 12, 4, 1, 13] +for i in list2: + if i % 2 == 0: + print(i) +""" +Expected Output: +2 +10 +12 +4 +""" diff --git a/Luhn_Algorithm.py b/luhn_algorithm_1.py similarity index 96% rename from Luhn_Algorithm.py rename to luhn_algorithm_1.py index 51eb03672aa..62150dba185 100644 --- a/Luhn_Algorithm.py +++ b/luhn_algorithm_1.py @@ -1,68 +1,68 @@ -#!/usr/bin/env python3 - -""" -Python Program using the Luhn Algorithm - -This program uses the Luhn Algorithm, named after its creator -Hans Peter Luhn, to calculate the check digit of a 10-digit -"payload" number, and output the final 11-digit number. - -To prove this program correctly calculates the check digit, -the input 7992739871 should return: - -Sum of all digits: 67 -Check digit: 3 -Full valid number (11 digits): 79927398713 - -11/15/2021 -David Costell (DontEatThemCookies on GitHub) -""" - -# Input -CC = input("Enter number to validate (e.g. 7992739871): ") -if len(CC) < 10 or len(CC) > 10: - input("Number must be 10 digits! ") - exit() - -# Use list comprehension to split the number into individual digits -split = [int(split) for split in str(CC)] - -# List of digits to be multiplied by 2 (to be doubled) -tobedoubled = [split[1], split[3], split[5], split[7], split[9]] -# List of remaining digits not to be multiplied -remaining = [split[0], split[2], split[4], split[6], split[8]] - -# Step 1 -# Double all values in the tobedoubled list -# Put the newly-doubled values in a new list -newdoubled = [] -for i in tobedoubled: - i = i * 2 - newdoubled.append(i) -tobedoubled = newdoubled - -# Check for any double-digit items in the tobedoubled list -# Splits all double-digit items into two single-digit items -newdoubled = [] -for i in tobedoubled: - if i > 9: - splitdigit = str(i) - for index in range(0, len(splitdigit), 1): - newdoubled.append(splitdigit[index : index + 1]) - tobedoubled.remove(i) -newdoubled = [int(i) for i in newdoubled] - -# Unify all lists into one (luhnsum) -luhnsum = [] -luhnsum.extend(tobedoubled) -luhnsum.extend(newdoubled) -luhnsum.extend(remaining) - -# Output -print("Final digit list:", luhnsum) -print("Sum of all digits:", sum(luhnsum)) -checkdigit = 10 - sum(luhnsum) % 10 -print("Check digit:", checkdigit) -finalcc = str(CC) + str(checkdigit) -print("Full valid number (11 digits):", finalcc) -input() +#!/usr/bin/env python3 + +""" +Python Program using the Luhn Algorithm + +This program uses the Luhn Algorithm, named after its creator +Hans Peter Luhn, to calculate the check digit of a 10-digit +"payload" number, and output the final 11-digit number. + +To prove this program correctly calculates the check digit, +the input 7992739871 should return: + +Sum of all digits: 67 +Check digit: 3 +Full valid number (11 digits): 79927398713 + +11/15/2021 +David Costell (DontEatThemCookies on GitHub) +""" + +# Input +CC = input("Enter number to validate (e.g. 7992739871): ") +if len(CC) < 10 or len(CC) > 10: + input("Number must be 10 digits! ") + exit() + +# Use list comprehension to split the number into individual digits +split = [int(split) for split in str(CC)] + +# List of digits to be multiplied by 2 (to be doubled) +tobedoubled = [split[1], split[3], split[5], split[7], split[9]] +# List of remaining digits not to be multiplied +remaining = [split[0], split[2], split[4], split[6], split[8]] + +# Step 1 +# Double all values in the tobedoubled list +# Put the newly-doubled values in a new list +newdoubled = [] +for i in tobedoubled: + i = i * 2 + newdoubled.append(i) +tobedoubled = newdoubled + +# Check for any double-digit items in the tobedoubled list +# Splits all double-digit items into two single-digit items +newdoubled = [] +for i in tobedoubled: + if i > 9: + splitdigit = str(i) + for index in range(0, len(splitdigit), 1): + newdoubled.append(splitdigit[index : index + 1]) + tobedoubled.remove(i) +newdoubled = [int(i) for i in newdoubled] + +# Unify all lists into one (luhnsum) +luhnsum = [] +luhnsum.extend(tobedoubled) +luhnsum.extend(newdoubled) +luhnsum.extend(remaining) + +# Output +print("Final digit list:", luhnsum) +print("Sum of all digits:", sum(luhnsum)) +checkdigit = 10 - sum(luhnsum) % 10 +print("Check digit:", checkdigit) +finalcc = str(CC) + str(checkdigit) +print("Full valid number (11 digits):", finalcc) +input() diff --git a/Mad Libs Generator.py b/mad_libs_generator.py similarity index 100% rename from Mad Libs Generator.py rename to mad_libs_generator.py diff --git a/Memory_game.py b/memory_game_1.py similarity index 100% rename from Memory_game.py rename to memory_game_1.py diff --git a/Merge_linked_list.py b/merge_linked_list_1.py similarity index 100% rename from Merge_linked_list.py rename to merge_linked_list_1.py diff --git a/missing number from list.py b/missing_number_from_list.py similarity index 100% rename from missing number from list.py rename to missing_number_from_list.py diff --git a/ML House Prediction.ipynb b/ml_house_prediction.ipynb similarity index 100% rename from ML House Prediction.ipynb rename to ml_house_prediction.ipynb diff --git a/mobilePhoneSpecsScrapper.py b/mobilephonespecsscrapper_1.py similarity index 100% rename from mobilePhoneSpecsScrapper.py rename to mobilephonespecsscrapper_1.py diff --git a/MobiusFunction.py b/mobiusfunction_1.py similarity index 100% rename from MobiusFunction.py rename to mobiusfunction_1.py diff --git a/Model Usage.ipynb b/model_usage.ipynb similarity index 100% rename from Model Usage.ipynb rename to model_usage.ipynb diff --git a/Monitor Apache b/monitor_apache similarity index 100% rename from Monitor Apache rename to monitor_apache diff --git a/Mp3_media_player.py b/mp3_media_player_1.py similarity index 100% rename from Mp3_media_player.py rename to mp3_media_player_1.py diff --git a/Multiply.py b/multiply_1.py similarity index 100% rename from Multiply.py rename to multiply_1.py diff --git a/my project b/my_project similarity index 100% rename from my project rename to my_project diff --git a/MySQL_Databses.py b/mysql_databses_1.py similarity index 100% rename from MySQL_Databses.py rename to mysql_databses_1.py diff --git a/nDigitNumberCombinations.py b/ndigitnumbercombinations_1.py similarity index 100% rename from nDigitNumberCombinations.py rename to ndigitnumbercombinations_1.py diff --git a/number guessing.py b/number_guessing.py similarity index 100% rename from number guessing.py rename to number_guessing.py diff --git a/Number reverse.py b/number_reverse.py similarity index 100% rename from Number reverse.py rename to number_reverse.py diff --git a/Organise.py b/organise_1.py similarity index 95% rename from Organise.py rename to organise_1.py index 4133e4138fc..8e08bba2a05 100644 --- a/Organise.py +++ b/organise_1.py @@ -1,110 +1,110 @@ -from __future__ import print_function - -import os -import shutil -import sys - -EXT_VIDEO_LIST = ["FLV", "WMV", "MOV", "MP4", "MPEG", "3GP", "MKV", "AVI"] -EXT_IMAGE_LIST = ["JPG", "JPEG", "GIF", "PNG", "SVG"] -EXT_DOCUMENT_LIST = [ - "DOC", - "DOCX", - "PPT", - "PPTX", - "PAGES", - "PDF", - "ODT", - "ODP", - "XLSX", - "XLS", - "ODS", - "TXT", - "IN", - "OUT", - "MD", -] -EXT_MUSIC_LIST = ["MP3", "WAV", "WMA", "MKA", "AAC", "MID", "RA", "RAM", "RM", "OGG"] -EXT_CODE_LIST = ["CPP", "RB", "PY", "HTML", "CSS", "JS"] -EXT_EXECUTABLE_LIST = ["LNK", "DEB", "EXE", "SH", "BUNDLE"] -EXT_COMPRESSED_LIST = [ - "RAR", - "JAR", - "ZIP", - "TAR", - "MAR", - "ISO", - "LZ", - "7ZIP", - "TGZ", - "GZ", - "BZ2", -] - -# Taking the location of the Folder to Arrange -try: - destLocation = str(sys.argv[1]) -except IndexError: - destLocation = str(input("Enter the Path of directory: ")) - - -# When we make a folder that already exist then WindowsError happen -# Changing directory may give WindowsError -def ChangeDirectory(dir): - try: - os.chdir(dir) - except WindowsError: - print("Error! Cannot change the Directory") - print("Enter a valid directory!") - ChangeDirectory(str(input("Enter the Path of directory: "))) - - -ChangeDirectory(destLocation) - - -def Organize(dirs, name): - try: - os.mkdir(name) - print("{} Folder Created".format(name)) - except WindowsError: - print("{} Folder Exist".format(name)) - - src = "{}\\{}".format(destLocation, dirs) - dest = "{}\{}".format(destLocation, name) - - os.chdir(dest) - shutil.move(src, "{}\\{}".format(dest, dirs)) - - print(os.getcwd()) - os.chdir(destLocation) - - -TYPES_LIST = [ - "Video", - "Images", - "Documents", - "Music", - "Codes", - "Executables", - "Compressed", -] -for dirs in os.listdir(os.getcwd()): - if 1: - for name, extensions_list in zip( - TYPES_LIST, - [ - EXT_VIDEO_LIST, - EXT_IMAGE_LIST, - EXT_DOCUMENT_LIST, - EXT_MUSIC_LIST, - EXT_CODE_LIST, - EXT_EXECUTABLE_LIST, - EXT_COMPRESSED_LIST, - ], - ): - if dirs.split(".")[-1].upper() in extensions_list: - Organize(dirs, name) - else: - if dirs not in TYPES_LIST: - Organize(dirs, "Folders") - -print("Done Arranging Files and Folder in your specified directory") +from __future__ import print_function + +import os +import shutil +import sys + +EXT_VIDEO_LIST = ["FLV", "WMV", "MOV", "MP4", "MPEG", "3GP", "MKV", "AVI"] +EXT_IMAGE_LIST = ["JPG", "JPEG", "GIF", "PNG", "SVG"] +EXT_DOCUMENT_LIST = [ + "DOC", + "DOCX", + "PPT", + "PPTX", + "PAGES", + "PDF", + "ODT", + "ODP", + "XLSX", + "XLS", + "ODS", + "TXT", + "IN", + "OUT", + "MD", +] +EXT_MUSIC_LIST = ["MP3", "WAV", "WMA", "MKA", "AAC", "MID", "RA", "RAM", "RM", "OGG"] +EXT_CODE_LIST = ["CPP", "RB", "PY", "HTML", "CSS", "JS"] +EXT_EXECUTABLE_LIST = ["LNK", "DEB", "EXE", "SH", "BUNDLE"] +EXT_COMPRESSED_LIST = [ + "RAR", + "JAR", + "ZIP", + "TAR", + "MAR", + "ISO", + "LZ", + "7ZIP", + "TGZ", + "GZ", + "BZ2", +] + +# Taking the location of the Folder to Arrange +try: + destLocation = str(sys.argv[1]) +except IndexError: + destLocation = str(input("Enter the Path of directory: ")) + + +# When we make a folder that already exist then WindowsError happen +# Changing directory may give WindowsError +def ChangeDirectory(dir): + try: + os.chdir(dir) + except WindowsError: + print("Error! Cannot change the Directory") + print("Enter a valid directory!") + ChangeDirectory(str(input("Enter the Path of directory: "))) + + +ChangeDirectory(destLocation) + + +def Organize(dirs, name): + try: + os.mkdir(name) + print("{} Folder Created".format(name)) + except WindowsError: + print("{} Folder Exist".format(name)) + + src = "{}\\{}".format(destLocation, dirs) + dest = "{}\{}".format(destLocation, name) + + os.chdir(dest) + shutil.move(src, "{}\\{}".format(dest, dirs)) + + print(os.getcwd()) + os.chdir(destLocation) + + +TYPES_LIST = [ + "Video", + "Images", + "Documents", + "Music", + "Codes", + "Executables", + "Compressed", +] +for dirs in os.listdir(os.getcwd()): + if 1: + for name, extensions_list in zip( + TYPES_LIST, + [ + EXT_VIDEO_LIST, + EXT_IMAGE_LIST, + EXT_DOCUMENT_LIST, + EXT_MUSIC_LIST, + EXT_CODE_LIST, + EXT_EXECUTABLE_LIST, + EXT_COMPRESSED_LIST, + ], + ): + if dirs.split(".")[-1].upper() in extensions_list: + Organize(dirs, name) + else: + if dirs not in TYPES_LIST: + Organize(dirs, "Folders") + +print("Done Arranging Files and Folder in your specified directory") diff --git a/Palindrome_Checker.py b/palindrome_checker_1.py similarity index 100% rename from Palindrome_Checker.py rename to palindrome_checker_1.py diff --git a/Password Generator/pass_gen.py b/password_generator/pass_gen.py similarity index 100% rename from Password Generator/pass_gen.py rename to password_generator/pass_gen.py diff --git a/Password Generator/requirements.txt b/password_generator/requirements.txt similarity index 100% rename from Password Generator/requirements.txt rename to password_generator/requirements.txt diff --git a/Password Generator/requirements_new.txt b/password_generator/requirements_new.txt similarity index 100% rename from Password Generator/requirements_new.txt rename to password_generator/requirements_new.txt diff --git a/passwordGen.py b/passwordgen_1.py similarity index 96% rename from passwordGen.py rename to passwordgen_1.py index 357c14619fc..93d677f9980 100644 --- a/passwordGen.py +++ b/passwordgen_1.py @@ -1,29 +1,29 @@ -import random - -lChars = "abcdefghijklmnopqrstuvwxyz" -uChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" -digits = "1234567890" -specialChars = "!@#$%^&*-_+=" - -passLen = 10 # actual generated password length will be this length + 1 -myPass = "" - -for i in range(passLen): - while (len(myPass)) <= 2: - index = random.randrange(len(lChars)) - myPass = myPass + lChars[index] - myPassLen = len(myPass) - while (len(myPass)) <= 5: - index = random.randrange(len(digits)) - myPass = myPass + digits[index] - myPassLen = len(myPass) - while (len(myPass)) <= 7: - index = random.randrange(len(specialChars)) - myPass = myPass + specialChars[index] - myPassLen = len(myPass) - while (len(myPass)) <= 10: - index = random.randrange(len(uChars)) - myPass = myPass + uChars[index] - myPassLen = len(myPass) - -print(myPass) +import random + +lChars = "abcdefghijklmnopqrstuvwxyz" +uChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +digits = "1234567890" +specialChars = "!@#$%^&*-_+=" + +passLen = 10 # actual generated password length will be this length + 1 +myPass = "" + +for i in range(passLen): + while (len(myPass)) <= 2: + index = random.randrange(len(lChars)) + myPass = myPass + lChars[index] + myPassLen = len(myPass) + while (len(myPass)) <= 5: + index = random.randrange(len(digits)) + myPass = myPass + digits[index] + myPassLen = len(myPass) + while (len(myPass)) <= 7: + index = random.randrange(len(specialChars)) + myPass = myPass + specialChars[index] + myPassLen = len(myPass) + while (len(myPass)) <= 10: + index = random.randrange(len(uChars)) + myPass = myPass + uChars[index] + myPassLen = len(myPass) + +print(myPass) diff --git a/passwordGenerator.py b/passwordgenerator_1.py similarity index 100% rename from passwordGenerator.py rename to passwordgenerator_1.py diff --git a/Patterns/pattern1.py b/patterns_1/pattern1.py similarity index 100% rename from Patterns/pattern1.py rename to patterns_1/pattern1.py diff --git a/Patterns/pattern2.py b/patterns_1/pattern2.py similarity index 100% rename from Patterns/pattern2.py rename to patterns_1/pattern2.py diff --git a/Patterns/pattern3.py b/patterns_1/pattern3.py similarity index 100% rename from Patterns/pattern3.py rename to patterns_1/pattern3.py diff --git a/Patterns/pattern5.py b/patterns_1/pattern5.py similarity index 100% rename from Patterns/pattern5.py rename to patterns_1/pattern5.py diff --git a/Patterns/pattern6.py b/patterns_1/pattern6.py similarity index 94% rename from Patterns/pattern6.py rename to patterns_1/pattern6.py index 1f02d6ce55a..6d6917d8766 100644 --- a/Patterns/pattern6.py +++ b/patterns_1/pattern6.py @@ -1,17 +1,17 @@ -# Python code to print the following alphabet pattern -#A -#B B -#C C C -#D D D D -#E E E E E -def alphabetpattern(n): - num = 65 - for i in range(0, n): - for j in range(0, i+1): - ch = chr(num) - print(ch, end=" ") - num = num + 1 - print("\r") - -a = 5 -alphabetpattern(a) +# Python code to print the following alphabet pattern +#A +#B B +#C C C +#D D D D +#E E E E E +def alphabetpattern(n): + num = 65 + for i in range(0, n): + for j in range(0, i+1): + ch = chr(num) + print(ch, end=" ") + num = num + 1 + print("\r") + +a = 5 +alphabetpattern(a) diff --git a/Patterns/patterns.py b/patterns_1/patterns.py similarity index 100% rename from Patterns/patterns.py rename to patterns_1/patterns.py diff --git a/PDF/basic.py b/pdf_1/basic.py similarity index 100% rename from PDF/basic.py rename to pdf_1/basic.py diff --git a/PDF/header_footer.py b/pdf_1/header_footer.py similarity index 100% rename from PDF/header_footer.py rename to pdf_1/header_footer.py diff --git a/PDF/images.py b/pdf_1/images.py similarity index 100% rename from PDF/images.py rename to pdf_1/images.py diff --git a/PDF/images/ss.png b/pdf_1/images/ss.png similarity index 100% rename from PDF/images/ss.png rename to pdf_1/images/ss.png diff --git a/PDF/output.pdf b/pdf_1/output.pdf similarity index 100% rename from PDF/output.pdf rename to pdf_1/output.pdf diff --git a/PDF/requirements.txt b/pdf_1/requirements.txt similarity index 100% rename from PDF/requirements.txt rename to pdf_1/requirements.txt diff --git a/PDFtoAudiobook.py b/pdftoaudiobook_1.py similarity index 100% rename from PDFtoAudiobook.py rename to pdftoaudiobook_1.py diff --git a/Polyline.py b/polyline_1.py similarity index 100% rename from Polyline.py rename to polyline_1.py diff --git a/PONG_GAME.py b/pong_game_1.py similarity index 100% rename from PONG_GAME.py rename to pong_game_1.py diff --git a/PongPong_Game/README.md b/pongpong_game_1/README.md similarity index 100% rename from PongPong_Game/README.md rename to pongpong_game_1/README.md diff --git a/PongPong_Game/pong/__init__.py b/pongpong_game_1/pong/__init__.py similarity index 100% rename from PongPong_Game/pong/__init__.py rename to pongpong_game_1/pong/__init__.py diff --git a/PongPong_Game/pong/ball.py b/pongpong_game_1/pong/ball.py similarity index 100% rename from PongPong_Game/pong/ball.py rename to pongpong_game_1/pong/ball.py diff --git a/PongPong_Game/pong/load.py b/pongpong_game_1/pong/load.py similarity index 100% rename from PongPong_Game/pong/load.py rename to pongpong_game_1/pong/load.py diff --git a/PongPong_Game/pong/paddle.py b/pongpong_game_1/pong/paddle.py similarity index 100% rename from PongPong_Game/pong/paddle.py rename to pongpong_game_1/pong/paddle.py diff --git a/PongPong_Game/pong/rectangle.py b/pongpong_game_1/pong/rectangle.py similarity index 100% rename from PongPong_Game/pong/rectangle.py rename to pongpong_game_1/pong/rectangle.py diff --git a/PongPong_Game/pong_game_play.gif b/pongpong_game_1/pong_game_play.gif similarity index 100% rename from PongPong_Game/pong_game_play.gif rename to pongpong_game_1/pong_game_play.gif diff --git a/PongPong_Game/pongpong.py b/pongpong_game_1/pongpong.py similarity index 100% rename from PongPong_Game/pongpong.py rename to pongpong_game_1/pongpong.py diff --git a/PongPong_Game/requirements.txt b/pongpong_game_1/requirements.txt similarity index 100% rename from PongPong_Game/requirements.txt rename to pongpong_game_1/requirements.txt diff --git a/PORT SCANNER.PY b/port_scanner.py similarity index 100% rename from PORT SCANNER.PY rename to port_scanner.py diff --git a/positiveNegetive.py b/positivenegetive_1.py similarity index 100% rename from positiveNegetive.py rename to positivenegetive_1.py diff --git a/Python Distance.py b/powers_of_2.py similarity index 100% rename from Python Distance.py rename to powers_of_2.py diff --git a/PRACTICEPROJECT-DISREGARD.txt b/practiceproject-disregard_1.txt similarity index 100% rename from PRACTICEPROJECT-DISREGARD.txt rename to practiceproject-disregard_1.txt diff --git a/prime number.py b/prime_number_1.py similarity index 100% rename from prime number.py rename to prime_number_1.py diff --git a/Prime_number.py b/prime_number_2.py similarity index 100% rename from Prime_number.py rename to prime_number_2.py diff --git a/print hello world.py b/print_hello_world.py similarity index 100% rename from print hello world.py rename to print_hello_world.py diff --git a/Print_List_of_Even_Numbers.py b/print_list_of_even_numbers_1.py similarity index 96% rename from Print_List_of_Even_Numbers.py rename to print_list_of_even_numbers_1.py index 5addb87407f..c79755d2332 100644 --- a/Print_List_of_Even_Numbers.py +++ b/print_list_of_even_numbers_1.py @@ -1,19 +1,19 @@ -# Very sort method to creat list of even number form a given list -# Advance-Python -list_number = list(map(int, input().split())) -even_list = [i for i in list_number if i % 2 == 0] -print(even_list) -exit() # Another one -n = int(input("Enter the required range : ")) # user input -list = [] - -if n < 0: - print("Not a valid number, please enter a positive number!") -else: - for i in range(0, n + 1): - if i % 2 == 0: - list.append( - i - ) # appending items to the initialised list getting from the 'if' statement - -print(list) +# Very sort method to creat list of even number form a given list +# Advance-Python +list_number = list(map(int, input().split())) +even_list = [i for i in list_number if i % 2 == 0] +print(even_list) +exit() # Another one +n = int(input("Enter the required range : ")) # user input +list = [] + +if n < 0: + print("Not a valid number, please enter a positive number!") +else: + for i in range(0, n + 1): + if i % 2 == 0: + list.append( + i + ) # appending items to the initialised list getting from the 'if' statement + +print(list) diff --git a/Print_List_of_Odd_Numbers.py b/print_list_of_odd_numbers_1.py similarity index 100% rename from Print_List_of_Odd_Numbers.py rename to print_list_of_odd_numbers_1.py diff --git a/Program of Reverse of any number.py b/program_of_reverse_of_any_number.py similarity index 100% rename from Program of Reverse of any number.py rename to program_of_reverse_of_any_number.py diff --git a/Program to print table of given number.py b/program_to_print_table_of_given_number.py similarity index 100% rename from Program to print table of given number.py rename to program_to_print_table_of_given_number.py diff --git a/Program to reverse Linked List( Recursive solution).py b/program_to_reverse_linked_list(_recursive_solution).py similarity index 100% rename from Program to reverse Linked List( Recursive solution).py rename to program_to_reverse_linked_list(_recursive_solution).py diff --git a/pythagoreanTriplets.py b/pythagoreantriplets_1.py similarity index 100% rename from pythagoreanTriplets.py rename to pythagoreantriplets_1.py diff --git a/Python-Array-Equilibrium-Index.py b/python-array-equilibrium-index_1.py similarity index 100% rename from Python-Array-Equilibrium-Index.py rename to python-array-equilibrium-index_1.py diff --git a/Python_chatting_application/README.md b/python_chatting_application_1/README.md similarity index 96% rename from Python_chatting_application/README.md rename to python_chatting_application_1/README.md index 5344eaa3dcc..1eeabd61853 100644 --- a/Python_chatting_application/README.md +++ b/python_chatting_application_1/README.md @@ -1,2 +1,2 @@ -# Python_chat_App -Simple chat application using python +# Python_chat_App +Simple chat application using python diff --git a/Python_chatting_application/client.py b/python_chatting_application_1/client.py similarity index 96% rename from Python_chatting_application/client.py rename to python_chatting_application_1/client.py index 447e7b6c448..d49c0901169 100644 --- a/Python_chatting_application/client.py +++ b/python_chatting_application_1/client.py @@ -1,45 +1,45 @@ -import socket -import threading - -flag = 0 -s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) -hostname = input("Enter your host :: ") -s.connect((hostname, 1023)) -nickname = input("Enter your Name :: ") - - -def recieve(): - while True: - try: - msg = s.recv(1024).decode("utf-8") - if msg == "NICK": - print("Welcome to Chat room :: ", nickname) - s.send(bytes(nickname, "utf-8")) - else: - print(msg) - except Exception as error: - print(f"An Erro occured {error}") - s.close() - flag = 1 - break - - -def Write(): - while True: - try: - reply_msg = f"{nickname} :: {input()}" - s.send(bytes(reply_msg, "utf-8")) - except Exception as error: - print(f"An Error Occured while sending message !!!\n error : {error}") - s.close() - flag = 1 - break - - -if flag == 1: - exit() -recieve_thrd = threading.Thread(target=recieve) -recieve_thrd.start() - -write_thrd = threading.Thread(target=Write) -write_thrd.start() +import socket +import threading + +flag = 0 +s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +hostname = input("Enter your host :: ") +s.connect((hostname, 1023)) +nickname = input("Enter your Name :: ") + + +def recieve(): + while True: + try: + msg = s.recv(1024).decode("utf-8") + if msg == "NICK": + print("Welcome to Chat room :: ", nickname) + s.send(bytes(nickname, "utf-8")) + else: + print(msg) + except Exception as error: + print(f"An Erro occured {error}") + s.close() + flag = 1 + break + + +def Write(): + while True: + try: + reply_msg = f"{nickname} :: {input()}" + s.send(bytes(reply_msg, "utf-8")) + except Exception as error: + print(f"An Error Occured while sending message !!!\n error : {error}") + s.close() + flag = 1 + break + + +if flag == 1: + exit() +recieve_thrd = threading.Thread(target=recieve) +recieve_thrd.start() + +write_thrd = threading.Thread(target=Write) +write_thrd.start() diff --git a/Python_chatting_application/server.py b/python_chatting_application_1/server.py similarity index 96% rename from Python_chatting_application/server.py rename to python_chatting_application_1/server.py index 1ff9141e9dd..519b387e008 100644 --- a/Python_chatting_application/server.py +++ b/python_chatting_application_1/server.py @@ -1,56 +1,56 @@ -import socket -import threading - -s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) -s.bind((socket.gethostname(), 1023)) -print(socket.gethostname()) -s.listen(5) - -clients = [] -nickename = [] - - -def Client_Handler(cli): - while True: - try: - reply = cli.recv(1024).decode("utf-8") - if reply == "QUIT": - index_of_cli = clients.index(cli) - nick = nickename[index_of_cli] - nickename.remove(nick) - clients.remove(cli) - BroadCasating(f"{nick} has left the chat room") - print(f"Disconnected with f{nick}") - break - BroadCasating(reply) - except Exception: - index_of_cli = clients.index(cli) - print(index_of_cli) - nick = nickename[index_of_cli] - nickename.remove(nick) - clients.remove(cli) - BroadCasating(f"{nick} has left the chat room") - print(f"Disconnected with {nick}") - break - - -def BroadCasating(msg): - for client in clients: - client.send(bytes(msg, "utf-8")) - - -def recieve(): - while True: - client_sckt, addr = s.accept() - print(f"Connection has been established {addr}") - client_sckt.send(bytes("NICK", "utf-8")) - nick = client_sckt.recv(1024).decode("utf-8") - nickename.append(nick) - clients.append(client_sckt) - print(f"{nick} has joined the chat room ") - BroadCasating(f"{nick} has joined the chat room say hi !!!") - threading._start_new_thread(Client_Handler, (client_sckt,)) - - -recieve() -s.close() +import socket +import threading + +s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +s.bind((socket.gethostname(), 1023)) +print(socket.gethostname()) +s.listen(5) + +clients = [] +nickename = [] + + +def Client_Handler(cli): + while True: + try: + reply = cli.recv(1024).decode("utf-8") + if reply == "QUIT": + index_of_cli = clients.index(cli) + nick = nickename[index_of_cli] + nickename.remove(nick) + clients.remove(cli) + BroadCasating(f"{nick} has left the chat room") + print(f"Disconnected with f{nick}") + break + BroadCasating(reply) + except Exception: + index_of_cli = clients.index(cli) + print(index_of_cli) + nick = nickename[index_of_cli] + nickename.remove(nick) + clients.remove(cli) + BroadCasating(f"{nick} has left the chat room") + print(f"Disconnected with {nick}") + break + + +def BroadCasating(msg): + for client in clients: + client.send(bytes(msg, "utf-8")) + + +def recieve(): + while True: + client_sckt, addr = s.accept() + print(f"Connection has been established {addr}") + client_sckt.send(bytes("NICK", "utf-8")) + nick = client_sckt.recv(1024).decode("utf-8") + nickename.append(nick) + clients.append(client_sckt) + print(f"{nick} has joined the chat room ") + BroadCasating(f"{nick} has joined the chat room say hi !!!") + threading._start_new_thread(Client_Handler, (client_sckt,)) + + +recieve() +s.close() diff --git a/powers of 2.py b/python_distance.py similarity index 100% rename from powers of 2.py rename to python_distance.py diff --git a/Python Program for factorial of a number b/python_program_for_factorial_of_a_number similarity index 100% rename from Python Program for factorial of a number rename to python_program_for_factorial_of_a_number diff --git a/python program for finding square root for positive number.py b/python_program_for_finding_square_root_for_positive_number.py similarity index 100% rename from python program for finding square root for positive number.py rename to python_program_for_finding_square_root_for_positive_number.py diff --git a/Python Program for Product of unique prime factors of a number.py b/python_program_for_product_of_unique_prime_factors_of_a_number.py similarity index 100% rename from Python Program for Product of unique prime factors of a number.py rename to python_program_for_product_of_unique_prime_factors_of_a_number.py diff --git a/Python Program for Tower of Hanoi.py b/python_program_for_tower_of_hanoi.py similarity index 100% rename from Python Program for Tower of Hanoi.py rename to python_program_for_tower_of_hanoi.py diff --git a/Python Program to Count the Number of Each Vowel.py b/python_program_to_count_the_number_of_each_vowel.py similarity index 100% rename from Python Program to Count the Number of Each Vowel.py rename to python_program_to_count_the_number_of_each_vowel.py diff --git a/Python Program to Display Fibonacci Sequence Using Recursion.py b/python_program_to_display_fibonacci_sequence_using_recursion.py similarity index 100% rename from Python Program to Display Fibonacci Sequence Using Recursion.py rename to python_program_to_display_fibonacci_sequence_using_recursion.py diff --git a/Python Program to Find LCM.py b/python_program_to_find_lcm.py similarity index 100% rename from Python Program to Find LCM.py rename to python_program_to_find_lcm.py diff --git a/Python Program to Merge Mails.py b/python_program_to_merge_mails.py similarity index 100% rename from Python Program to Merge Mails.py rename to python_program_to_merge_mails.py diff --git a/how to display the fibonacci sequence up to n-.py b/python_program_to_print_the_fibonacci_sequence.py similarity index 100% rename from how to display the fibonacci sequence up to n-.py rename to python_program_to_print_the_fibonacci_sequence.py diff --git a/Python Program to Remove Punctuations from a String.py b/python_program_to_remove_punctuations_from_a_string.py similarity index 100% rename from Python Program to Remove Punctuations from a String.py rename to python_program_to_remove_punctuations_from_a_string.py diff --git a/Python Program to Reverse a linked list.py b/python_program_to_reverse_a_linked_list.py similarity index 100% rename from Python Program to Reverse a linked list.py rename to python_program_to_reverse_a_linked_list.py diff --git a/Python Program to Sort Words in Alphabetic Order.py b/python_program_to_sort_words_in_alphabetic_order.py similarity index 100% rename from Python Program to Sort Words in Alphabetic Order.py rename to python_program_to_sort_words_in_alphabetic_order.py diff --git a/Python Program to Transpose a Matrix.py b/python_program_to_transpose_a_matrix.py similarity index 100% rename from Python Program to Transpose a Matrix.py rename to python_program_to_transpose_a_matrix.py diff --git a/python Space Invader game.py b/python_space_invader_game.py similarity index 100% rename from python Space Invader game.py rename to python_space_invader_game.py diff --git a/Python_swapping.py b/python_swapping_1.py similarity index 100% rename from Python_swapping.py rename to python_swapping_1.py diff --git a/pythonVideoDownloader.py b/pythonvideodownloader_1.py similarity index 100% rename from pythonVideoDownloader.py rename to pythonvideodownloader_1.py diff --git a/QR_code_generator/qrcode.py b/qr_code_generator_1/qrcode.py old mode 100755 new mode 100644 similarity index 100% rename from QR_code_generator/qrcode.py rename to qr_code_generator_1/qrcode.py diff --git a/QuadraticCalc.py b/quadraticcalc_1.py similarity index 96% rename from QuadraticCalc.py rename to quadraticcalc_1.py index 305f7e1665a..ac2625a6de3 100644 --- a/QuadraticCalc.py +++ b/quadraticcalc_1.py @@ -1,44 +1,44 @@ -# GGearing -# 02/10/2017 -# Simple script to calculate the quadratic formula of a sequence of numbers and -# recognises when the sequence isn't quadratic - - -def findLinear(numbers): # find a & b of linear sequence - a = numbers[1] - numbers[0] - a1 = numbers[2] - numbers[1] - if a1 == a: - b = numbers[0] - a - return (a, b) - else: - print("Sequence is not linear") - - -sequence = [] -first_difference = [] -second_difference = [] -for i in range(4): # input - term = str(i + 1) - inp = int(input("Enter term " + term + ": ")) - sequence.append(inp) - -for i in range(3): - gradient = sequence[i + 1] - sequence[i] - first_difference.append(gradient) -for i in range(2): - gradient = first_difference[i + 1] - first_difference[i] - second_difference.append(gradient) - -if second_difference[0] == second_difference[1]: # checks to see if consistent - a = second_difference[0] / 2 - subs_diff = [] - for i in range(4): - n = i + 1 - num = a * (n * n) - subs_diff.append((sequence[i]) - num) - b, c = findLinear(subs_diff) - print( - "Nth term: " + str(a) + "n^2 + " + str(b) + "n + " + str(c) - ) # outputs nth term -else: - print("Sequence is not quadratic") +# GGearing +# 02/10/2017 +# Simple script to calculate the quadratic formula of a sequence of numbers and +# recognises when the sequence isn't quadratic + + +def findLinear(numbers): # find a & b of linear sequence + a = numbers[1] - numbers[0] + a1 = numbers[2] - numbers[1] + if a1 == a: + b = numbers[0] - a + return (a, b) + else: + print("Sequence is not linear") + + +sequence = [] +first_difference = [] +second_difference = [] +for i in range(4): # input + term = str(i + 1) + inp = int(input("Enter term " + term + ": ")) + sequence.append(inp) + +for i in range(3): + gradient = sequence[i + 1] - sequence[i] + first_difference.append(gradient) +for i in range(2): + gradient = first_difference[i + 1] - first_difference[i] + second_difference.append(gradient) + +if second_difference[0] == second_difference[1]: # checks to see if consistent + a = second_difference[0] / 2 + subs_diff = [] + for i in range(4): + n = i + 1 + num = a * (n * n) + subs_diff.append((sequence[i]) - num) + b, c = findLinear(subs_diff) + print( + "Nth term: " + str(a) + "n^2 + " + str(b) + "n + " + str(c) + ) # outputs nth term +else: + print("Sequence is not quadratic") diff --git a/Random Password Generator.py b/random_password_generator.py similarity index 100% rename from Random Password Generator.py rename to random_password_generator.py diff --git a/RandomDice.py b/randomdice_1.py similarity index 100% rename from RandomDice.py rename to randomdice_1.py diff --git a/Randomnumber.py b/randomnumber_1.py similarity index 100% rename from Randomnumber.py rename to randomnumber_1.py diff --git a/RandomNumberGame.py b/randomnumbergame_1.py similarity index 100% rename from RandomNumberGame.py rename to randomnumbergame_1.py diff --git a/ReadFromCSV.py b/readfromcsv_1.py similarity index 97% rename from ReadFromCSV.py rename to readfromcsv_1.py index f1921bd19e0..1feba4790cd 100644 --- a/ReadFromCSV.py +++ b/readfromcsv_1.py @@ -1,20 +1,20 @@ -__author__ = "vamsi" -import pandas as pd # pandas library to read csv file -from matplotlib import pyplot as plt # matplotlib library to visualise the data -from matplotlib import style - -style.use("ggplot") - -"""reading data from SalesData.csv file - and passing data to dataframe""" - -df = pd.read_csv("..\SalesData.csv") # Reading the csv file -x = df[ - "SalesID" -].as_matrix() # casting SalesID to list #extracting the column with name SalesID -y = df["ProductPrice"].as_matrix() # casting ProductPrice to list -plt.xlabel("SalesID") # assigning X-axis label -plt.ylabel("ProductPrice") # assigning Y-axis label -plt.title("Sales Analysis") # assigning Title to the graph -plt.plot(x, y) # Plot X and Y axis -plt.show() # Show the graph +__author__ = "vamsi" +import pandas as pd # pandas library to read csv file +from matplotlib import pyplot as plt # matplotlib library to visualise the data +from matplotlib import style + +style.use("ggplot") + +"""reading data from SalesData.csv file + and passing data to dataframe""" + +df = pd.read_csv("..\SalesData.csv") # Reading the csv file +x = df[ + "SalesID" +].as_matrix() # casting SalesID to list #extracting the column with name SalesID +y = df["ProductPrice"].as_matrix() # casting ProductPrice to list +plt.xlabel("SalesID") # assigning X-axis label +plt.ylabel("ProductPrice") # assigning Y-axis label +plt.title("Sales Analysis") # assigning Title to the graph +plt.plot(x, y) # Plot X and Y axis +plt.show() # Show the graph diff --git a/README.md b/readme_1.md similarity index 100% rename from README.md rename to readme_1.md diff --git a/Recursion Visulaizer/.recursionVisualizer.py.swp b/recursion_visulaizer/.recursionVisualizer.py.swp similarity index 100% rename from Recursion Visulaizer/.recursionVisualizer.py.swp rename to recursion_visulaizer/.recursionVisualizer.py.swp diff --git a/Recursion Visulaizer/Meshimproved.PNG b/recursion_visulaizer/Meshimproved.PNG similarity index 100% rename from Recursion Visulaizer/Meshimproved.PNG rename to recursion_visulaizer/Meshimproved.PNG diff --git a/Recursion Visulaizer/fencedmesh.PNG b/recursion_visulaizer/fencedmesh.PNG similarity index 100% rename from Recursion Visulaizer/fencedmesh.PNG rename to recursion_visulaizer/fencedmesh.PNG diff --git a/Recursion Visulaizer/git b/recursion_visulaizer/git similarity index 100% rename from Recursion Visulaizer/git rename to recursion_visulaizer/git diff --git a/Recursion Visulaizer/recursionVisualizer.py b/recursion_visulaizer/recursionVisualizer.py similarity index 100% rename from Recursion Visulaizer/recursionVisualizer.py rename to recursion_visulaizer/recursionVisualizer.py diff --git a/recursiveStrings.py b/recursivestrings_1.py similarity index 100% rename from recursiveStrings.py rename to recursivestrings_1.py diff --git a/remove a character from a file and rewrite.py b/remove_a_character_from_a_file_and_rewrite.py similarity index 100% rename from remove a character from a file and rewrite.py rename to remove_a_character_from_a_file_and_rewrite.py diff --git a/Reverse_list_in_groups.py b/reverse_list_in_groups_1.py similarity index 96% rename from Reverse_list_in_groups.py rename to reverse_list_in_groups_1.py index 9698811d7ea..13762db9c4c 100644 --- a/Reverse_list_in_groups.py +++ b/reverse_list_in_groups_1.py @@ -1,55 +1,55 @@ -class Node: - def __init__(self, data): - self.data = data - self.next = None - - -class Reverse_Linked_List: - def __init__(self): - self.head = None - - def Insert_At_End(self, new_data): - new_node = Node(new_data) - if self.head is None: - self.head = new_node - return - current = self.head - while current.next: - current = current.next - current.next = new_node - - def Reverse_list_Groups(self, head, k): - count = 0 - previous = None - current = head - while current is not None and count < k: - following = current.next - current.next = previous - previous = current - current = following - count += 1 - if following is not None: - head.next = self.Reverse_list_Groups(following, k) - return previous - - def Display(self): - temp = self.head - while temp: - print(temp.data, "->", end=" ") - temp = temp.next - print("None") - - -if __name__ == "__main__": - L_list = Reverse_Linked_List() - L_list.Insert_At_End(1) - L_list.Insert_At_End(2) - L_list.Insert_At_End(3) - L_list.Insert_At_End(4) - L_list.Insert_At_End(5) - L_list.Insert_At_End(6) - L_list.Insert_At_End(7) - L_list.Display() - L_list.head = L_list.Reverse_list_Groups(L_list.head, 2) - print("\nReverse Linked List: ") - L_list.Display() +class Node: + def __init__(self, data): + self.data = data + self.next = None + + +class Reverse_Linked_List: + def __init__(self): + self.head = None + + def Insert_At_End(self, new_data): + new_node = Node(new_data) + if self.head is None: + self.head = new_node + return + current = self.head + while current.next: + current = current.next + current.next = new_node + + def Reverse_list_Groups(self, head, k): + count = 0 + previous = None + current = head + while current is not None and count < k: + following = current.next + current.next = previous + previous = current + current = following + count += 1 + if following is not None: + head.next = self.Reverse_list_Groups(following, k) + return previous + + def Display(self): + temp = self.head + while temp: + print(temp.data, "->", end=" ") + temp = temp.next + print("None") + + +if __name__ == "__main__": + L_list = Reverse_Linked_List() + L_list.Insert_At_End(1) + L_list.Insert_At_End(2) + L_list.Insert_At_End(3) + L_list.Insert_At_End(4) + L_list.Insert_At_End(5) + L_list.Insert_At_End(6) + L_list.Insert_At_End(7) + L_list.Display() + L_list.head = L_list.Reverse_list_Groups(L_list.head, 2) + print("\nReverse Linked List: ") + L_list.Display() diff --git a/Rotate_Linked_List.py b/rotate_linked_list_1.py similarity index 96% rename from Rotate_Linked_List.py rename to rotate_linked_list_1.py index c4117989fec..d29decb3616 100644 --- a/Rotate_Linked_List.py +++ b/rotate_linked_list_1.py @@ -1,57 +1,57 @@ -class Node: - def __init__(self, data): - self.data = data - self.next = None - - -class Linked_List: - def __init__(self): - self.head = None - - def Insert_At_Beginning(self, new_data): - new_node = Node(new_data) - if self.head is None: - self.head = new_node - return - new_node.next = self.head - self.head = new_node - - def Rotation(self, key): - if key == 0: - return - current = self.head - count = 1 - while count < key and current is not None: - current = current.next - count += 1 - if current is None: - return - Kth_Node = current - while current.next is not None: - current = current.next - current.next = self.head - self.head = Kth_Node.next - Kth_Node.next = None - - def Display(self): - temp = self.head - while temp: - print(temp.data, "->", end=" ") - temp = temp.next - print("None") - - -if __name__ == "__main__": - L_list = Linked_List() - L_list.Insert_At_Beginning(8) - L_list.Insert_At_Beginning(5) - L_list.Insert_At_Beginning(10) - L_list.Insert_At_Beginning(7) - L_list.Insert_At_Beginning(6) - L_list.Insert_At_Beginning(11) - L_list.Insert_At_Beginning(9) - print("Linked List Before Rotation: ") - L_list.Display() - print("Linked List After Rotation: ") - L_list.Rotation(4) - L_list.Display() +class Node: + def __init__(self, data): + self.data = data + self.next = None + + +class Linked_List: + def __init__(self): + self.head = None + + def Insert_At_Beginning(self, new_data): + new_node = Node(new_data) + if self.head is None: + self.head = new_node + return + new_node.next = self.head + self.head = new_node + + def Rotation(self, key): + if key == 0: + return + current = self.head + count = 1 + while count < key and current is not None: + current = current.next + count += 1 + if current is None: + return + Kth_Node = current + while current.next is not None: + current = current.next + current.next = self.head + self.head = Kth_Node.next + Kth_Node.next = None + + def Display(self): + temp = self.head + while temp: + print(temp.data, "->", end=" ") + temp = temp.next + print("None") + + +if __name__ == "__main__": + L_list = Linked_List() + L_list.Insert_At_Beginning(8) + L_list.Insert_At_Beginning(5) + L_list.Insert_At_Beginning(10) + L_list.Insert_At_Beginning(7) + L_list.Insert_At_Beginning(6) + L_list.Insert_At_Beginning(11) + L_list.Insert_At_Beginning(9) + print("Linked List Before Rotation: ") + L_list.Display() + print("Linked List After Rotation: ") + L_list.Rotation(4) + L_list.Display() diff --git a/Secret message generator GUI by tkinter.py b/secret_message_generator_gui_by_tkinter.py similarity index 100% rename from Secret message generator GUI by tkinter.py rename to secret_message_generator_gui_by_tkinter.py diff --git a/Shivaansh.py b/shivaansh_1.py similarity index 96% rename from Shivaansh.py rename to shivaansh_1.py index deec715f10f..f20e73c1e4f 100644 --- a/Shivaansh.py +++ b/shivaansh_1.py @@ -1,5 +1,5 @@ -from __future__ import print_function - -x = input("Enter a number: ") -for i in range(1, 11, 1): - print(x, "x", i, "=", (x * i)) +from __future__ import print_function + +x = input("Enter a number: ") +for i in range(1, 11, 1): + print(x, "x", i, "=", (x * i)) diff --git a/Shortest Distance between Two Lines.py b/shortest_distance_between_two_lines.py similarity index 100% rename from Shortest Distance between Two Lines.py rename to shortest_distance_between_two_lines.py diff --git a/Simple calculator.py b/simple_calculator_1.py similarity index 100% rename from Simple calculator.py rename to simple_calculator_1.py diff --git a/Simple_Calculator.py b/simple_calculator_2.py similarity index 100% rename from Simple_Calculator.py rename to simple_calculator_2.py diff --git a/SimpleCalculator.py b/simplecalculator_1.py similarity index 100% rename from SimpleCalculator.py rename to simplecalculator_1.py diff --git a/simpleInterest.py b/simpleinterest_1.py similarity index 100% rename from simpleInterest.py rename to simpleinterest_1.py diff --git a/SimpleStopWatch.py b/simplestopwatch_1.py similarity index 100% rename from SimpleStopWatch.py rename to simplestopwatch_1.py diff --git a/Snake-Water-Gun-Game.py b/snake-water-gun-game_1.py similarity index 96% rename from Snake-Water-Gun-Game.py rename to snake-water-gun-game_1.py index 54341645888..87796cbf654 100644 --- a/Snake-Water-Gun-Game.py +++ b/snake-water-gun-game_1.py @@ -1,174 +1,174 @@ -""" -This is a snake water gun game similar to rock paper scissor -In this game : -if computer chooses snake and user chooses water, the snake will drink water and computer wins. -If computer chooses gun and user chooses water, the gun gets drown into water and user wins. -And so on for other cases -""" - -# you can use this code also, see this code is very short in compare to your code -# code starts here -""" -# Snake || Water || Gun __ Game -import random -times = 10 # times to play game -comp_choice = ["s","w","g"] # output choice for computer -user_point = 0 # user point is initially marked 0 -comp_point = 0 # computer point is initially marked 0 -while times >= 1: - comp_rand = random.choice(comp_choice) # output computer will give - # - # print(comp_rand) # checking if the code is working or not - print(f"ROUND LEFT = {times}") -# checking if the input is entered correct or not - try: - user_choice = input("Enter the input in lowercase ex. \n (snake- s) (water- w) (gun- w)\n:- ") # user choice, the user will input - except Exception as e: - print(e) -# if input doen't match this will run - if user_choice != 's' and user_choice != 'w' and user_choice != 'g': - print("Invalid input, try again\n") - continue -# checking the input and calculating score - if comp_rand == 's': - if user_choice == 'w': - comp_point += 1 - elif user_choice == 'g': - user_point += 1 - - elif comp_rand == 'w': - if user_choice == 'g': - comp_point += 1 - elif user_choice == 's': - user_point += 1 - - elif comp_rand == 'g': - if user_choice == 's': - comp_point += 1 - elif user_choice == 'w': - user_point += 1 - - times -=1 # reducing the number of rounds after each match -if user_point>comp_point: # if user wins - print(f"WOOUUH! You have win \nYour_point = {user_point}\nComputer_point = {comp_point}") -elif comp_point>user_point: # if computer wins - print(f"WE RESPECT YOUR HARD WORK, BUT YOU LOSE AND YOU ARE A LOSER NOW! \nYour_point = {user_point}\nComputer_point = {comp_point}") -elif comp_point==user_point: # if match draw - print(f"MATCH DRAW\nYour_point = {user_point}\nComputer_point = {comp_point}") -else: # just checked - print("can't calculate score") -exit = input("PRESS ENTER TO EXIT") -""" # code ends here -import random - -# import time - -choices = {"S": "Snake", "W": "Water", "G": "Gun"} - -x = 0 -comp_point = 0 -user_point = 0 -match_draw = 0 - -print("Welcome to the Snake-Water-Gun Game\n") -print("I am Mr. Computer, We will play this game 10 times") -print("Whoever wins more matches will be the winner\n") - -while x < 10: - print(f"Game No. {x+1}") - for key, value in choices.items(): - print(f"Choose {key} for {value}") - - comp_rand = random.choice(list(choices.keys())).lower() - user_choice = input("\n----->").lower() - print("Mr. Computer's choice is : " + comp_rand) - - # you can use this code to minimize your writing time for the code - """ - if comp_rand == 's': - if user_choice == 'w': - print("\n-------Mr. Computer won this round--------") - comp_point += 1 - elif user_choice == 'g': - print("\n-------You won this round-------") - user_point += 1 - else: - match_draw +=1 - - elif comp_rand == 'w': - if user_choice == 'g': - print("\n-------Mr. Computer won this round--------") - comp_point += 1 - elif user_choice == 's': - print("\n-------You won this round-------") - user_point += 1 - else: - match_draw +=1 - - elif comp_rand == 'g': - if user_choice == 's': - print("\n-------Mr. Computer won this round--------") - comp_point += 1 - elif user_choice == 'w': - print("\n-------You won this round-------") - user_point += 1 - else: - match_draw +=1 - - """ - - if comp_rand == "s": - if user_choice == "w": - print("\n-------Mr. Computer won this round--------") - comp_point += 1 - x += 1 - elif user_choice == "g": - print("\n-------You won this round-------") - user_point += 1 - x += 1 - else: - print("\n-------Match draw-------") - match_draw += 1 - x += 1 - - elif comp_rand == "w": - if user_choice == "g": - print("\n-------Mr. Computer won this round--------") - comp_point += 1 - x += 1 - elif user_choice == "s": - print("\n-------You won this round-------") - user_point += 1 - x += 1 - else: - print("\n-------Match draw-------") - match_draw += 1 - x += 1 - - elif comp_rand == "g": - if user_choice == "s": - print("\n-------Mr. Computer won this round--------") - comp_point += 1 - x += 1 - elif user_choice == "w": - print("\n-------You won this round-------") - user_point += 1 - x += 1 - else: - print("\n-------Match draw-------") - match_draw += 1 - x += 1 - -print("Here are final stats of the 10 matches : ") -print(f"Mr. Computer won : {comp_point} matches") -print(f"You won : {user_point} matches") -print(f"Matches Drawn : {match_draw}") - -if comp_point > user_point: - print("\n-------Mr. Computer won-------") - -elif comp_point < user_point: - print("\n-----------You won-----------") - -else: - print("\n----------Match Draw----------") +""" +This is a snake water gun game similar to rock paper scissor +In this game : +if computer chooses snake and user chooses water, the snake will drink water and computer wins. +If computer chooses gun and user chooses water, the gun gets drown into water and user wins. +And so on for other cases +""" + +# you can use this code also, see this code is very short in compare to your code +# code starts here +""" +# Snake || Water || Gun __ Game +import random +times = 10 # times to play game +comp_choice = ["s","w","g"] # output choice for computer +user_point = 0 # user point is initially marked 0 +comp_point = 0 # computer point is initially marked 0 +while times >= 1: + comp_rand = random.choice(comp_choice) # output computer will give + # + # print(comp_rand) # checking if the code is working or not + print(f"ROUND LEFT = {times}") +# checking if the input is entered correct or not + try: + user_choice = input("Enter the input in lowercase ex. \n (snake- s) (water- w) (gun- w)\n:- ") # user choice, the user will input + except Exception as e: + print(e) +# if input doen't match this will run + if user_choice != 's' and user_choice != 'w' and user_choice != 'g': + print("Invalid input, try again\n") + continue +# checking the input and calculating score + if comp_rand == 's': + if user_choice == 'w': + comp_point += 1 + elif user_choice == 'g': + user_point += 1 + + elif comp_rand == 'w': + if user_choice == 'g': + comp_point += 1 + elif user_choice == 's': + user_point += 1 + + elif comp_rand == 'g': + if user_choice == 's': + comp_point += 1 + elif user_choice == 'w': + user_point += 1 + + times -=1 # reducing the number of rounds after each match +if user_point>comp_point: # if user wins + print(f"WOOUUH! You have win \nYour_point = {user_point}\nComputer_point = {comp_point}") +elif comp_point>user_point: # if computer wins + print(f"WE RESPECT YOUR HARD WORK, BUT YOU LOSE AND YOU ARE A LOSER NOW! \nYour_point = {user_point}\nComputer_point = {comp_point}") +elif comp_point==user_point: # if match draw + print(f"MATCH DRAW\nYour_point = {user_point}\nComputer_point = {comp_point}") +else: # just checked + print("can't calculate score") +exit = input("PRESS ENTER TO EXIT") +""" # code ends here +import random + +# import time + +choices = {"S": "Snake", "W": "Water", "G": "Gun"} + +x = 0 +comp_point = 0 +user_point = 0 +match_draw = 0 + +print("Welcome to the Snake-Water-Gun Game\n") +print("I am Mr. Computer, We will play this game 10 times") +print("Whoever wins more matches will be the winner\n") + +while x < 10: + print(f"Game No. {x+1}") + for key, value in choices.items(): + print(f"Choose {key} for {value}") + + comp_rand = random.choice(list(choices.keys())).lower() + user_choice = input("\n----->").lower() + print("Mr. Computer's choice is : " + comp_rand) + + # you can use this code to minimize your writing time for the code + """ + if comp_rand == 's': + if user_choice == 'w': + print("\n-------Mr. Computer won this round--------") + comp_point += 1 + elif user_choice == 'g': + print("\n-------You won this round-------") + user_point += 1 + else: + match_draw +=1 + + elif comp_rand == 'w': + if user_choice == 'g': + print("\n-------Mr. Computer won this round--------") + comp_point += 1 + elif user_choice == 's': + print("\n-------You won this round-------") + user_point += 1 + else: + match_draw +=1 + + elif comp_rand == 'g': + if user_choice == 's': + print("\n-------Mr. Computer won this round--------") + comp_point += 1 + elif user_choice == 'w': + print("\n-------You won this round-------") + user_point += 1 + else: + match_draw +=1 + + """ + + if comp_rand == "s": + if user_choice == "w": + print("\n-------Mr. Computer won this round--------") + comp_point += 1 + x += 1 + elif user_choice == "g": + print("\n-------You won this round-------") + user_point += 1 + x += 1 + else: + print("\n-------Match draw-------") + match_draw += 1 + x += 1 + + elif comp_rand == "w": + if user_choice == "g": + print("\n-------Mr. Computer won this round--------") + comp_point += 1 + x += 1 + elif user_choice == "s": + print("\n-------You won this round-------") + user_point += 1 + x += 1 + else: + print("\n-------Match draw-------") + match_draw += 1 + x += 1 + + elif comp_rand == "g": + if user_choice == "s": + print("\n-------Mr. Computer won this round--------") + comp_point += 1 + x += 1 + elif user_choice == "w": + print("\n-------You won this round-------") + user_point += 1 + x += 1 + else: + print("\n-------Match draw-------") + match_draw += 1 + x += 1 + +print("Here are final stats of the 10 matches : ") +print(f"Mr. Computer won : {comp_point} matches") +print(f"You won : {user_point} matches") +print(f"Matches Drawn : {match_draw}") + +if comp_point > user_point: + print("\n-------Mr. Computer won-------") + +elif comp_point < user_point: + print("\n-----------You won-----------") + +else: + print("\n----------Match Draw----------") diff --git a/Snake_water_gun/README.md b/snake_water_gun_1/README.md similarity index 100% rename from Snake_water_gun/README.md rename to snake_water_gun_1/README.md diff --git a/Snake_water_gun/main.py b/snake_water_gun_1/main.py similarity index 96% rename from Snake_water_gun/main.py rename to snake_water_gun_1/main.py index 5a8b1332894..f1a2f679fc5 100644 --- a/Snake_water_gun/main.py +++ b/snake_water_gun_1/main.py @@ -1,98 +1,98 @@ -# This is an edited version -# Made the code much more easier to read -# Used better naming for variables -# There were few inconsistencies in the outputs of the first if/else/if ladder \ -# inside the while loop. That is solved. -import random -import time -from os import system - - -class bcolors: - HEADERS = "\033[95m" - OKBLUE = "\033[94m" - OKGREEN = "\033[93m" - WARNING = "\033[92m" - FAIL = "\033[91m" - ENDC = "\033[0m" - BOLD = "\033[1m" - UNDERLINE = "\033[4m" - - -run = True -li = ["s", "w", "g"] - -system("clear") -b = input( - bcolors.OKBLUE - + bcolors.BOLD - + "Welcome to the game 'Snake-Water-Gun'.\nWanna play? Type Y or N: " - + bcolors.ENDC -).capitalize() - -if b == "N": - run = False - print("Ok bubyeee! See you later") -elif b == "Y" or b == "y": - print( - "There will be 10 matches, and the one who wins more matches will win. Let's start." - ) - -i = 0 -score = 0 - -while run and i < 10: - - comp_choice = random.choice(li) - user_choice = input("Type s for snake, w for water or g for gun: ").lower() - - if user_choice == comp_choice: - print(bcolors.HEADERS + "Game draws. Play again" + bcolors.ENDC) - - elif user_choice == "s" and comp_choice == "g": - print(bcolors.FAIL + "It's Snake v/s Gun You lose!" + bcolors.ENDC) - - elif user_choice == "s" and comp_choice == "w": - print(bcolors.OKGREEN + "It's Snake v/s Water. You won" + bcolors.ENDC) - score += 1 - - elif user_choice == "w" and comp_choice == "s": - print(bcolors.FAIL + "It's Water v/s Snake You lose!" + bcolors.ENDC) - - elif user_choice == "w" and comp_choice == "g": - print(bcolors.OKGREEN + "It's Water v/s Gun. You won" + bcolors.ENDC) - score += 1 - - elif user_choice == "g" and comp_choice == "w": - print(bcolors.FAIL + "It's Gun v/s Water You lose!" + bcolors.ENDC) - - elif user_choice == "g" and comp_choice == "s": - print(bcolors.OKGREEN + "It's Gun v/s Snake. You won" + bcolors.ENDC) - score += 1 - - else: - print("Wrong input") - continue - - i += 1 - print(f"{10-i} matches left") - -if run == True: - print(f"Your score is {score} and the final result is...") - time.sleep(3) - if score > 5: - print( - bcolors.OKGREEN - + bcolors.BOLD - + "Woooh!!!!!!! Congratulations you won" - + bcolors.ENDC - ) - elif score == 5: - print("Game draws!!!!!!!") - elif score < 5: - print( - bcolors.FAIL - + bcolors.BOLD - + "You lose!!!. Better luck next time" - + bcolors.ENDC - ) +# This is an edited version +# Made the code much more easier to read +# Used better naming for variables +# There were few inconsistencies in the outputs of the first if/else/if ladder \ +# inside the while loop. That is solved. +import random +import time +from os import system + + +class bcolors: + HEADERS = "\033[95m" + OKBLUE = "\033[94m" + OKGREEN = "\033[93m" + WARNING = "\033[92m" + FAIL = "\033[91m" + ENDC = "\033[0m" + BOLD = "\033[1m" + UNDERLINE = "\033[4m" + + +run = True +li = ["s", "w", "g"] + +system("clear") +b = input( + bcolors.OKBLUE + + bcolors.BOLD + + "Welcome to the game 'Snake-Water-Gun'.\nWanna play? Type Y or N: " + + bcolors.ENDC +).capitalize() + +if b == "N": + run = False + print("Ok bubyeee! See you later") +elif b == "Y" or b == "y": + print( + "There will be 10 matches, and the one who wins more matches will win. Let's start." + ) + +i = 0 +score = 0 + +while run and i < 10: + + comp_choice = random.choice(li) + user_choice = input("Type s for snake, w for water or g for gun: ").lower() + + if user_choice == comp_choice: + print(bcolors.HEADERS + "Game draws. Play again" + bcolors.ENDC) + + elif user_choice == "s" and comp_choice == "g": + print(bcolors.FAIL + "It's Snake v/s Gun You lose!" + bcolors.ENDC) + + elif user_choice == "s" and comp_choice == "w": + print(bcolors.OKGREEN + "It's Snake v/s Water. You won" + bcolors.ENDC) + score += 1 + + elif user_choice == "w" and comp_choice == "s": + print(bcolors.FAIL + "It's Water v/s Snake You lose!" + bcolors.ENDC) + + elif user_choice == "w" and comp_choice == "g": + print(bcolors.OKGREEN + "It's Water v/s Gun. You won" + bcolors.ENDC) + score += 1 + + elif user_choice == "g" and comp_choice == "w": + print(bcolors.FAIL + "It's Gun v/s Water You lose!" + bcolors.ENDC) + + elif user_choice == "g" and comp_choice == "s": + print(bcolors.OKGREEN + "It's Gun v/s Snake. You won" + bcolors.ENDC) + score += 1 + + else: + print("Wrong input") + continue + + i += 1 + print(f"{10-i} matches left") + +if run == True: + print(f"Your score is {score} and the final result is...") + time.sleep(3) + if score > 5: + print( + bcolors.OKGREEN + + bcolors.BOLD + + "Woooh!!!!!!! Congratulations you won" + + bcolors.ENDC + ) + elif score == 5: + print("Game draws!!!!!!!") + elif score < 5: + print( + bcolors.FAIL + + bcolors.BOLD + + "You lose!!!. Better luck next time" + + bcolors.ENDC + ) diff --git a/solution to euler project problem 10.py b/solution_to_euler_project_problem_10.py similarity index 100% rename from solution to euler project problem 10.py rename to solution_to_euler_project_problem_10.py diff --git a/Sorting Algorithms/Binary_Insertion_Sort.py b/sorting_algorithms/Binary_Insertion_Sort.py similarity index 100% rename from Sorting Algorithms/Binary_Insertion_Sort.py rename to sorting_algorithms/Binary_Insertion_Sort.py diff --git a/Sorting Algorithms/Bubble_Sorting_Prog.py b/sorting_algorithms/Bubble_Sorting_Prog.py similarity index 100% rename from Sorting Algorithms/Bubble_Sorting_Prog.py rename to sorting_algorithms/Bubble_Sorting_Prog.py diff --git a/Sorting Algorithms/Bubble_sort.py b/sorting_algorithms/Bubble_sort.py similarity index 100% rename from Sorting Algorithms/Bubble_sort.py rename to sorting_algorithms/Bubble_sort.py diff --git a/Sorting Algorithms/Count sort.py b/sorting_algorithms/Count sort.py similarity index 100% rename from Sorting Algorithms/Count sort.py rename to sorting_algorithms/Count sort.py diff --git a/Sorting Algorithms/Counting Sort.py b/sorting_algorithms/Counting Sort.py similarity index 100% rename from Sorting Algorithms/Counting Sort.py rename to sorting_algorithms/Counting Sort.py diff --git a/Sorting Algorithms/Counting-sort.py b/sorting_algorithms/Counting-sort.py similarity index 100% rename from Sorting Algorithms/Counting-sort.py rename to sorting_algorithms/Counting-sort.py diff --git a/Sorting Algorithms/Cycle Sort.py b/sorting_algorithms/Cycle Sort.py similarity index 100% rename from Sorting Algorithms/Cycle Sort.py rename to sorting_algorithms/Cycle Sort.py diff --git a/Sorting Algorithms/Heap sort.py b/sorting_algorithms/Heap sort.py similarity index 100% rename from Sorting Algorithms/Heap sort.py rename to sorting_algorithms/Heap sort.py diff --git a/Sorting Algorithms/Iterative Merge Sort.py b/sorting_algorithms/Iterative Merge Sort.py similarity index 100% rename from Sorting Algorithms/Iterative Merge Sort.py rename to sorting_algorithms/Iterative Merge Sort.py diff --git a/Sorting Algorithms/Linear_Insertion_Sort.py b/sorting_algorithms/Linear_Insertion_Sort.py similarity index 100% rename from Sorting Algorithms/Linear_Insertion_Sort.py rename to sorting_algorithms/Linear_Insertion_Sort.py diff --git a/Sorting Algorithms/Merge Sort.py b/sorting_algorithms/Merge Sort.py similarity index 100% rename from Sorting Algorithms/Merge Sort.py rename to sorting_algorithms/Merge Sort.py diff --git a/Sorting Algorithms/Merge-sort.py b/sorting_algorithms/Merge-sort.py similarity index 100% rename from Sorting Algorithms/Merge-sort.py rename to sorting_algorithms/Merge-sort.py diff --git a/Sorting Algorithms/Quick sort.py b/sorting_algorithms/Quick sort.py similarity index 100% rename from Sorting Algorithms/Quick sort.py rename to sorting_algorithms/Quick sort.py diff --git a/Sorting Algorithms/Shell Sort.py b/sorting_algorithms/Shell Sort.py similarity index 100% rename from Sorting Algorithms/Shell Sort.py rename to sorting_algorithms/Shell Sort.py diff --git a/Sorting Algorithms/Sort the values of first list using second list.py b/sorting_algorithms/Sort the values of first list using second list.py similarity index 100% rename from Sorting Algorithms/Sort the values of first list using second list.py rename to sorting_algorithms/Sort the values of first list using second list.py diff --git a/Sorting Algorithms/Sorted_Inserted_Linked_List.py b/sorting_algorithms/Sorted_Inserted_Linked_List.py similarity index 100% rename from Sorting Algorithms/Sorted_Inserted_Linked_List.py rename to sorting_algorithms/Sorted_Inserted_Linked_List.py diff --git a/Sorting Algorithms/SortingAStringAlphabetically.py b/sorting_algorithms/SortingAStringAlphabetically.py similarity index 100% rename from Sorting Algorithms/SortingAStringAlphabetically.py rename to sorting_algorithms/SortingAStringAlphabetically.py diff --git a/Sorting Algorithms/Sorting_List.py b/sorting_algorithms/Sorting_List.py similarity index 100% rename from Sorting Algorithms/Sorting_List.py rename to sorting_algorithms/Sorting_List.py diff --git a/Sorting Algorithms/Tim_sort.py b/sorting_algorithms/Tim_sort.py similarity index 100% rename from Sorting Algorithms/Tim_sort.py rename to sorting_algorithms/Tim_sort.py diff --git a/Sorting Algorithms/brickSort.py b/sorting_algorithms/brickSort.py similarity index 100% rename from Sorting Algorithms/brickSort.py rename to sorting_algorithms/brickSort.py diff --git a/Sorting Algorithms/bubblesortpgm.py b/sorting_algorithms/bubblesortpgm.py similarity index 100% rename from Sorting Algorithms/bubblesortpgm.py rename to sorting_algorithms/bubblesortpgm.py diff --git a/Sorting Algorithms/heap_sort.py b/sorting_algorithms/heap_sort.py similarity index 100% rename from Sorting Algorithms/heap_sort.py rename to sorting_algorithms/heap_sort.py diff --git a/Sorting Algorithms/insertion_sort.py b/sorting_algorithms/insertion_sort.py similarity index 100% rename from Sorting Algorithms/insertion_sort.py rename to sorting_algorithms/insertion_sort.py diff --git a/Sorting Algorithms/merge_sort.py b/sorting_algorithms/merge_sort.py similarity index 100% rename from Sorting Algorithms/merge_sort.py rename to sorting_algorithms/merge_sort.py diff --git a/Sorting Algorithms/pigeonhole_sort.py b/sorting_algorithms/pigeonhole_sort.py similarity index 100% rename from Sorting Algorithms/pigeonhole_sort.py rename to sorting_algorithms/pigeonhole_sort.py diff --git a/Sorting Algorithms/quick_sort.py b/sorting_algorithms/quick_sort.py similarity index 100% rename from Sorting Algorithms/quick_sort.py rename to sorting_algorithms/quick_sort.py diff --git a/Sorting Algorithms/recursive-quick-sort.py b/sorting_algorithms/recursive-quick-sort.py similarity index 100% rename from Sorting Algorithms/recursive-quick-sort.py rename to sorting_algorithms/recursive-quick-sort.py diff --git a/Sorting Algorithms/selectionSort.py b/sorting_algorithms/selectionSort.py similarity index 100% rename from Sorting Algorithms/selectionSort.py rename to sorting_algorithms/selectionSort.py diff --git a/Sorting Algorithms/selection_sort.py b/sorting_algorithms/selection_sort.py similarity index 100% rename from Sorting Algorithms/selection_sort.py rename to sorting_algorithms/selection_sort.py diff --git a/Sorting Algorithms/sorting.py b/sorting_algorithms/sorting.py similarity index 100% rename from Sorting Algorithms/sorting.py rename to sorting_algorithms/sorting.py diff --git a/Sorting Algorithms/stooge_sort.py b/sorting_algorithms/stooge_sort.py similarity index 100% rename from Sorting Algorithms/stooge_sort.py rename to sorting_algorithms/stooge_sort.py diff --git a/Sorting Algorithms/wave_sort.py b/sorting_algorithms/wave_sort.py similarity index 100% rename from Sorting Algorithms/wave_sort.py rename to sorting_algorithms/wave_sort.py diff --git a/SOUNDEX.py b/soundex_1.py similarity index 100% rename from SOUNDEX.py rename to soundex_1.py diff --git a/Split_Circular_Linked_List.py b/split_circular_linked_list_1.py similarity index 96% rename from Split_Circular_Linked_List.py rename to split_circular_linked_list_1.py index eadba3ce34a..e6b0942b7a7 100644 --- a/Split_Circular_Linked_List.py +++ b/split_circular_linked_list_1.py @@ -1,67 +1,67 @@ -class Node: - def __init__(self, data): - self.data = data - self.next = None - - -class Circular_Linked_List: - def __init__(self): - self.head = None - - def Push(self, data): - temp = Node(data) - temp.next = self.head - temp1 = self.head - if self.head is not None: - while temp1.next is not None: - temp1 = temp1.next - temp1.next = temp - else: - temp.next = temp - self.head = temp - - def Split_List(self, head1, head2): - if self.head is None: - return - slow_ptr = self.head - fast_ptr = self.head - while fast_ptr.next != self.head and fast_ptr.next.next != self.head: - fast_ptr = fast_ptr.next.next - slow_ptr = slow_ptr.next.next - if fast_ptr.next.next == self.head: - fast_ptr = fast_ptr.next - head1 = self.head - slow_ptr.next = head1 - if self.head.next != self.head: - head2.head = slow_ptr.next - fast_ptr.next = slow_ptr.next - - def Display(self): - temp = self.head - if self.head is not None: - while temp: - print(temp.data, "->", end=" ") - temp = temp.next - if temp == self.head: - print(temp.data) - break - - -if __name__ == "__main__": - - L_list = Circular_Linked_List() - head1 = Circular_Linked_List() - head2 = Circular_Linked_List() - L_list.Push(6) - L_list.Push(4) - L_list.Push(2) - L_list.Push(8) - L_list.Push(12) - L_list.Push(10) - L_list.Split_List(head1, head2) - print("Circular Linked List: ") - L_list.Display() - print("Firts Split Linked List: ") - head1.Display() - print("Second Split Linked List: ") - head2.Display() +class Node: + def __init__(self, data): + self.data = data + self.next = None + + +class Circular_Linked_List: + def __init__(self): + self.head = None + + def Push(self, data): + temp = Node(data) + temp.next = self.head + temp1 = self.head + if self.head is not None: + while temp1.next is not None: + temp1 = temp1.next + temp1.next = temp + else: + temp.next = temp + self.head = temp + + def Split_List(self, head1, head2): + if self.head is None: + return + slow_ptr = self.head + fast_ptr = self.head + while fast_ptr.next != self.head and fast_ptr.next.next != self.head: + fast_ptr = fast_ptr.next.next + slow_ptr = slow_ptr.next.next + if fast_ptr.next.next == self.head: + fast_ptr = fast_ptr.next + head1 = self.head + slow_ptr.next = head1 + if self.head.next != self.head: + head2.head = slow_ptr.next + fast_ptr.next = slow_ptr.next + + def Display(self): + temp = self.head + if self.head is not None: + while temp: + print(temp.data, "->", end=" ") + temp = temp.next + if temp == self.head: + print(temp.data) + break + + +if __name__ == "__main__": + + L_list = Circular_Linked_List() + head1 = Circular_Linked_List() + head2 = Circular_Linked_List() + L_list.Push(6) + L_list.Push(4) + L_list.Push(2) + L_list.Push(8) + L_list.Push(12) + L_list.Push(10) + L_list.Split_List(head1, head2) + print("Circular Linked List: ") + L_list.Display() + print("Firts Split Linked List: ") + head1.Display() + print("Second Split Linked List: ") + head2.Display() diff --git a/spotifyAccount.py b/spotifyaccount_1.py similarity index 100% rename from spotifyAccount.py rename to spotifyaccount_1.py diff --git a/stackF_Harsh2255.py b/stackf_harsh2255_1.py similarity index 100% rename from stackF_Harsh2255.py rename to stackf_harsh2255_1.py diff --git a/String_Palindrome.py b/string_palindrome_1.py similarity index 100% rename from String_Palindrome.py rename to string_palindrome_1.py diff --git a/Strings.py b/strings_1.py similarity index 100% rename from Strings.py rename to strings_1.py diff --git a/StringToBinary.py b/stringtobinary_1.py similarity index 100% rename from StringToBinary.py rename to stringtobinary_1.py diff --git a/Sum of digits of a number.py b/sum_of_digits_of_a_number.py similarity index 100% rename from Sum of digits of a number.py rename to sum_of_digits_of_a_number.py diff --git a/sWAP_cASE.py b/swap_case_1.py similarity index 100% rename from sWAP_cASE.py rename to swap_case_1.py diff --git a/Swap numbers.py b/swap_numbers.py similarity index 100% rename from Swap numbers.py rename to swap_numbers.py diff --git a/swapping of two numbers b/swapping_of_two_numbers similarity index 100% rename from swapping of two numbers rename to swapping_of_two_numbers diff --git a/Test-Case-Generator/test_case.py b/test-case-generator_1/test_case.py similarity index 100% rename from Test-Case-Generator/test_case.py rename to test-case-generator_1/test_case.py diff --git a/text to speech b/text_to_speech similarity index 100% rename from text to speech rename to text_to_speech diff --git a/Tic_Tac_Toe.py b/tic_tac_toe_1.py similarity index 100% rename from Tic_Tac_Toe.py rename to tic_tac_toe_1.py diff --git a/TicTacToe.py b/tictactoe_1.py similarity index 100% rename from TicTacToe.py rename to tictactoe_1.py diff --git a/Timetable_Operations.py b/timetable_operations_1.py similarity index 100% rename from Timetable_Operations.py rename to timetable_operations_1.py diff --git a/to check leap year b/to_check_leap_year similarity index 100% rename from to check leap year rename to to_check_leap_year diff --git a/To find the largest number between 3 numbers.py b/to_find_the_largest_number_between_3_numbers.py similarity index 100% rename from To find the largest number between 3 numbers.py rename to to_find_the_largest_number_between_3_numbers.py diff --git a/To print series 1,12,123,1234......py b/to_print_series_1,12,123,1234......py similarity index 100% rename from To print series 1,12,123,1234......py rename to to_print_series_1,12,123,1234......py diff --git a/translation_of_sizes_of_underwear_RU.py b/translation_of_sizes_of_underwear_ru_1.py similarity index 100% rename from translation_of_sizes_of_underwear_RU.py rename to translation_of_sizes_of_underwear_ru_1.py diff --git a/Translator/README.md b/translator_1/README.md similarity index 100% rename from Translator/README.md rename to translator_1/README.md diff --git a/Translator/translator.py b/translator_1/translator.py similarity index 100% rename from Translator/translator.py rename to translator_1/translator.py diff --git a/Triplets with zero sum/Readme.md b/triplets_with_zero_sum/Readme.md similarity index 100% rename from Triplets with zero sum/Readme.md rename to triplets_with_zero_sum/Readme.md diff --git a/Triplets with zero sum/find_Triplets_with_zero_sum.py b/triplets_with_zero_sum/find_Triplets_with_zero_sum.py similarity index 100% rename from Triplets with zero sum/find_Triplets_with_zero_sum.py rename to triplets_with_zero_sum/find_Triplets_with_zero_sum.py diff --git a/TTS.py b/tts_1.py similarity index 96% rename from TTS.py rename to tts_1.py index a151388ce21..2599b97a600 100644 --- a/TTS.py +++ b/tts_1.py @@ -1,31 +1,31 @@ -from tkinter import * -from platform import system - -if system() == "Windows" or "nt": - import win32com.client as wincl -else: - print("Sorry, TTS client is not supported on Linux or MacOS") - exit() - - -def text2Speech(): - text = e.get() - speak = wincl.Dispatch("SAPI.SpVoice") - speak.Speak(text) - - -# window configs -tts = Tk() -tts.wm_title("Text to Speech") -tts.geometry("225x105") -tts.config(background="#708090") - -f = Frame(tts, height=280, width=500, bg="#bebebe") -f.grid(row=0, column=0, padx=10, pady=5) -lbl = Label(f, text="Enter your Text here : ") -lbl.grid(row=1, column=0, padx=10, pady=2) -e = Entry(f, width=30) -e.grid(row=2, column=0, padx=10, pady=2) -btn = Button(f, text="Speak", command=text2Speech) -btn.grid(row=3, column=0, padx=20, pady=10) -tts.mainloop() +from tkinter import * +from platform import system + +if system() == "Windows" or "nt": + import win32com.client as wincl +else: + print("Sorry, TTS client is not supported on Linux or MacOS") + exit() + + +def text2Speech(): + text = e.get() + speak = wincl.Dispatch("SAPI.SpVoice") + speak.Speak(text) + + +# window configs +tts = Tk() +tts.wm_title("Text to Speech") +tts.geometry("225x105") +tts.config(background="#708090") + +f = Frame(tts, height=280, width=500, bg="#bebebe") +f.grid(row=0, column=0, padx=10, pady=5) +lbl = Label(f, text="Enter your Text here : ") +lbl.grid(row=1, column=0, padx=10, pady=2) +e = Entry(f, width=30) +e.grid(row=2, column=0, padx=10, pady=2) +btn = Button(f, text="Speak", command=text2Speech) +btn.grid(row=3, column=0, padx=20, pady=10) +tts.mainloop() diff --git a/Turn your PDFs into audio books/audiobook_gen.py b/turn_your_pdfs_into_audio_books/audiobook_gen.py similarity index 95% rename from Turn your PDFs into audio books/audiobook_gen.py rename to turn_your_pdfs_into_audio_books/audiobook_gen.py index cd54bc0a89a..7987ffc3e6b 100644 --- a/Turn your PDFs into audio books/audiobook_gen.py +++ b/turn_your_pdfs_into_audio_books/audiobook_gen.py @@ -1,20 +1,20 @@ -import PyPDF2 -import pyttsx3 - -book = open(input("Enter the book name: "), "rb") -pg_no = int( - input( - "Enter the page number from which you want the system to start reading text: " - ) -) - -pdf_Reader = PyPDF2.PdfFileReader(book) -pages = pdf_Reader.numPages - -speaker = pyttsx3.init() - -for num in range((pg_no - 1), pages): - page = pdf_Reader.getPage(num) - text = page.extractText() - speaker.say(text) - speaker.runAndWait() +import PyPDF2 +import pyttsx3 + +book = open(input("Enter the book name: "), "rb") +pg_no = int( + input( + "Enter the page number from which you want the system to start reading text: " + ) +) + +pdf_Reader = PyPDF2.PdfFileReader(book) +pages = pdf_Reader.numPages + +speaker = pyttsx3.init() + +for num in range((pg_no - 1), pages): + page = pdf_Reader.getPage(num) + text = page.extractText() + speaker.say(text) + speaker.runAndWait() diff --git a/Turn your PDFs into audio books/requirements.txt b/turn_your_pdfs_into_audio_books/requirements.txt similarity index 100% rename from Turn your PDFs into audio books/requirements.txt rename to turn_your_pdfs_into_audio_books/requirements.txt diff --git a/turtal game.ipynb b/turtal_game.ipynb similarity index 100% rename from turtal game.ipynb rename to turtal_game.ipynb diff --git a/turtle module b/turtle_module similarity index 100% rename from turtle module rename to turtle_module diff --git a/Turtle_Star.py b/turtle_star_1.py similarity index 100% rename from Turtle_Star.py rename to turtle_star_1.py diff --git a/Tweet Pre-Processing.py b/tweet_pre-processing.py similarity index 100% rename from Tweet Pre-Processing.py rename to tweet_pre-processing.py diff --git a/Type of angles of a triangle.py b/type_of_angles_of_a_triangle.py similarity index 100% rename from Type of angles of a triangle.py rename to type_of_angles_of_a_triangle.py diff --git a/Type_of_angles_of_triangle.py b/type_of_angles_of_triangle_1.py similarity index 100% rename from Type_of_angles_of_triangle.py rename to type_of_angles_of_triangle_1.py diff --git a/UI-Apps/README.md b/ui-apps_1/README.md similarity index 100% rename from UI-Apps/README.md rename to ui-apps_1/README.md diff --git a/UI-Apps/clock.py b/ui-apps_1/clock.py similarity index 100% rename from UI-Apps/clock.py rename to ui-apps_1/clock.py diff --git a/Unit Digit of a raised to power b.py b/unit_digit_of_a_raised_to_power_b.py similarity index 100% rename from Unit Digit of a raised to power b.py rename to unit_digit_of_a_raised_to_power_b.py diff --git a/Untitled.ipynb b/untitled_1.ipynb similarity index 100% rename from Untitled.ipynb rename to untitled_1.ipynb diff --git a/Voice Command Calculator.py b/voice_command_calculator.py similarity index 100% rename from Voice Command Calculator.py rename to voice_command_calculator.py diff --git a/VoiceAssistant/DOCUMENTATION.md b/voiceassistant_1/DOCUMENTATION.md similarity index 98% rename from VoiceAssistant/DOCUMENTATION.md rename to voiceassistant_1/DOCUMENTATION.md index 8aaacdb05a8..56a8f529e77 100644 --- a/VoiceAssistant/DOCUMENTATION.md +++ b/voiceassistant_1/DOCUMENTATION.md @@ -1,78 +1,78 @@ -# *DOCUMENTATION* - -There are 8 files(modules) present in the main package of this project. These files are named as follows: - - -1. VoiceAssistant\_main.py -1. speakListen.py -1. websiteWork.py -1. textRead.py -1. dictator.py -1. menu.py -1. speechtotext.py -1. TextToSpeech.py - -A combination of all these modules makes the Voice Assistant work efficiently. - -## VoiceAssistant\_main.py - -This is the main file that encapsulates the other 7 files. It is advisable to run this file to avail all the benefits of the Voice Assistant. - -After giving the command to run this file to your computer, you will have to say “**Hello Python**†to activate the voice assistant. After the activation, a menu will be displayed on the screen, showing all the tasks that Voice Assistant can do. This menu is displayed with the help of the print\_menu()* function present in the menu.py module. - -Speaking out the respective commands of the desired task will indicate the Voice Assistant to do the following task. Once the speech is recorded, it will be converted to ` str ` by hear() or short\_hear() function of the speakListen.py module. - -For termination of the program after a task is complete, the command “**close python**†should be spoken. For abrupt termination of the program, for Windows and Linux – The ctrl + c key combination should be used. - -## speakListen.py - -This is the module that contains the following functions: - - -1. speak(text) – This function speaks out the ‘text’ provided as a parameter. The text is a string(str). They say() and runAndWait() functions of Engine class in pyttsx3 enable the assistant to speak. Microsoft ***SAPI5*** has provided the voice. -1. hear() – This function records the voice for 9 seconds using your microphone as source and converts speech to text using recognize\_google(). recognize\_google() performs speech recognition on ``audio\_data`` (an ``AudioData`` instance), using the Google Speech Recognition API. -1. long\_hear(duration\_time) – This function records voice for the ‘duration\_time’ provided with 60 seconds as the default time. It too converts speech to text in a similar fashion to hear() -1. short\_hear(duration\_time) – This functions records voice similar to hear() but for 5 seconds. -1. greet(g) - Uses the datetime library to generate current time and then greets accordingly. - -## websiteWork.py - -This module mainly handles this project's ‘searching on the web’ task. It uses wikipedia and webbrowser libraries to aid its tasks. Following are the functions present in this module: - - -1. google\_search() – Searches the sentence spoken by the user on the web and opens the google-searched results in the default browser. -1. wiki\_search() - Searches the sentence spoken by the user on the web and opens the Wikipedia-searched results in the default browser. It also speaks out the summary of the result and asks the user whether he wants to open the website of the corresponding query. - -## textRead.py - -This module is mainly related to file processing and converting text to speech. Following are the functions present in this module: - - -1. ms\_word – Read out the TEXT in MS Word (.docx) file provided in the location. -1. pdf\_read – Can be used to read pdf files and more specifically eBooks. It has 3 options - 1. Read a single page - 1. Read a range of pages - 1. Read a lesson - 1. Read the whole book - -It can also print the index and can find out the author’s name, the title, and the total number of pages in the PDF file. - -1. doubleslash(location) – Mainly intended to help Windows users, if the user copies the default path containing 1 ‘/ ’; the program doubles it so it is not considered an escape sequence. -1. print\_index(toc) - Prints out the index in proper format with the title name and page number. It takes ‘toc’ as a parameter which is a nested list with toc[i][1] - Topic name and toc[i][2] – with page number. -1. print\_n\_speak\_index(toc) - It is similar to print\_index(), but it also speaks out the index here. -1. book\_details(author, title, total\_pages) - Creates a table of book details like author name, title, and total pages. It uses table and console from rich library. - -**IMPORTANT: The voice assistant asks you the location of your file to be read by it. It won’t detect the file if it is present in the OneDrive folder or any other protected or third-party folder. Also, it would give an error if the extension of the file is not provided.** - -**For example; Consider a docx file ‘***abc***’ and pdf file ‘***fgh***’ present in valid directories and folders named ‘***folder\_loc’***.** - -** When location is fed as ‘* **folder\_loc \abc***’ or ‘* **folder\_loc\fgh’* **it gives an error,** - -** but if the location is given as** *‘folder\_loc \abc.docx’* **or ‘** *folder\_loc \fgh.pdf’***, then it won’t give an error.** - -## dictator.py - -This module is like the dictator function and dictates the text that we speak. So basically, it converts the speech that we speak to text. The big\_text(duration\_time) function encapsulates the long\_hear() function. So by default, it records for 60 seconds but it can record for any amount of time as specified by the user. - -## menu.py - -It prints out the menu which contains the tasks and their corresponding commands. The rich library is being used here. - - - +# *DOCUMENTATION* + +There are 8 files(modules) present in the main package of this project. These files are named as follows: - + +1. VoiceAssistant\_main.py +1. speakListen.py +1. websiteWork.py +1. textRead.py +1. dictator.py +1. menu.py +1. speechtotext.py +1. TextToSpeech.py + +A combination of all these modules makes the Voice Assistant work efficiently. + +## VoiceAssistant\_main.py + +This is the main file that encapsulates the other 7 files. It is advisable to run this file to avail all the benefits of the Voice Assistant. + +After giving the command to run this file to your computer, you will have to say “**Hello Python**†to activate the voice assistant. After the activation, a menu will be displayed on the screen, showing all the tasks that Voice Assistant can do. This menu is displayed with the help of the print\_menu()* function present in the menu.py module. + +Speaking out the respective commands of the desired task will indicate the Voice Assistant to do the following task. Once the speech is recorded, it will be converted to ` str ` by hear() or short\_hear() function of the speakListen.py module. + +For termination of the program after a task is complete, the command “**close python**†should be spoken. For abrupt termination of the program, for Windows and Linux – The ctrl + c key combination should be used. + +## speakListen.py + +This is the module that contains the following functions: - + +1. speak(text) – This function speaks out the ‘text’ provided as a parameter. The text is a string(str). They say() and runAndWait() functions of Engine class in pyttsx3 enable the assistant to speak. Microsoft ***SAPI5*** has provided the voice. +1. hear() – This function records the voice for 9 seconds using your microphone as source and converts speech to text using recognize\_google(). recognize\_google() performs speech recognition on ``audio\_data`` (an ``AudioData`` instance), using the Google Speech Recognition API. +1. long\_hear(duration\_time) – This function records voice for the ‘duration\_time’ provided with 60 seconds as the default time. It too converts speech to text in a similar fashion to hear() +1. short\_hear(duration\_time) – This functions records voice similar to hear() but for 5 seconds. +1. greet(g) - Uses the datetime library to generate current time and then greets accordingly. + +## websiteWork.py + +This module mainly handles this project's ‘searching on the web’ task. It uses wikipedia and webbrowser libraries to aid its tasks. Following are the functions present in this module: - + +1. google\_search() – Searches the sentence spoken by the user on the web and opens the google-searched results in the default browser. +1. wiki\_search() - Searches the sentence spoken by the user on the web and opens the Wikipedia-searched results in the default browser. It also speaks out the summary of the result and asks the user whether he wants to open the website of the corresponding query. + +## textRead.py + +This module is mainly related to file processing and converting text to speech. Following are the functions present in this module: - + +1. ms\_word – Read out the TEXT in MS Word (.docx) file provided in the location. +1. pdf\_read – Can be used to read pdf files and more specifically eBooks. It has 3 options + 1. Read a single page + 1. Read a range of pages + 1. Read a lesson + 1. Read the whole book + +It can also print the index and can find out the author’s name, the title, and the total number of pages in the PDF file. + +1. doubleslash(location) – Mainly intended to help Windows users, if the user copies the default path containing 1 ‘/ ’; the program doubles it so it is not considered an escape sequence. +1. print\_index(toc) - Prints out the index in proper format with the title name and page number. It takes ‘toc’ as a parameter which is a nested list with toc[i][1] - Topic name and toc[i][2] – with page number. +1. print\_n\_speak\_index(toc) - It is similar to print\_index(), but it also speaks out the index here. +1. book\_details(author, title, total\_pages) - Creates a table of book details like author name, title, and total pages. It uses table and console from rich library. + +**IMPORTANT: The voice assistant asks you the location of your file to be read by it. It won’t detect the file if it is present in the OneDrive folder or any other protected or third-party folder. Also, it would give an error if the extension of the file is not provided.** + +**For example; Consider a docx file ‘***abc***’ and pdf file ‘***fgh***’ present in valid directories and folders named ‘***folder\_loc’***.** + +** When location is fed as ‘* **folder\_loc \abc***’ or ‘* **folder\_loc\fgh’* **it gives an error,** + +** but if the location is given as** *‘folder\_loc \abc.docx’* **or ‘** *folder\_loc \fgh.pdf’***, then it won’t give an error.** + +## dictator.py + +This module is like the dictator function and dictates the text that we speak. So basically, it converts the speech that we speak to text. The big\_text(duration\_time) function encapsulates the long\_hear() function. So by default, it records for 60 seconds but it can record for any amount of time as specified by the user. + +## menu.py + +It prints out the menu which contains the tasks and their corresponding commands. The rich library is being used here. + + + diff --git a/VoiceAssistant/GUIDE.md b/voiceassistant_1/GUIDE.md similarity index 98% rename from VoiceAssistant/GUIDE.md rename to voiceassistant_1/GUIDE.md index e4aabf88a23..eb2e01b90a6 100644 --- a/VoiceAssistant/GUIDE.md +++ b/voiceassistant_1/GUIDE.md @@ -1,43 +1,43 @@ -# *GUIDE* - -
-You can run this voice assistant through an .exe file as well as through the terminal. When using it as an .exe file, be sure to keep the .exe file in its setup. - -

a) For using Voice Assistant through TERMINAL WINDOW

- -1. All the pre-requisites should be complete to run the Voice Assistant in the terminal window. -1. Create a GitHub account if not created already. -2. The code is present in the file *Project_Basic_struct* -3. The source code can be downloaded using the following link: - - -This source code should be cloned using the git commands. - -For more information about cloning a GitHub repository, go to the following link - - -
After cloning the project, to use this project do the following :-
-$ Run the file VoiceAssistant\_main.py in the terminal using the command:- python VoiceAssistant\_main.py
-1. For more details about running a python code follow the link: - -1. For Windows - -1. For Linux - -1. For MacOS - - -

b) For using Voice Assistant through an EXECUTABLE (.exe) file

- -Download - https://github.com/SohamRatnaparkhi/Voice-Assistant/releases/tag/v1.0.0 - -Download the rar file. - -1. Extract the folder. -2. Open VoiceAssistant folder. -3. Double-click on the file \_1\_VoiceAssistant for using it. - -In case, if you don't find \_1\_VoiceAssistant in the Voice Assistant folder, just install the executable(.exe) file AND SAVE IT IN VoiceAssistant FOLDER. **It is advisable to run the (.exe) file in the VoiceAssistant folder; else the file won't run.** - -

Using the Voice Assistant after installation of its resources

- -- Saying "Hello Python" will activate the Voice Assistant. -- Then the table that will be displayed on the screen shows the tasks that Voice Assistant can do. -- Saying the respective commands of the task that is intended will enable the Voice Assistant to do those tasks. -- The README.md file of this repository has more information about the individual commands. - -![Voice Assistant](https://user-images.githubusercontent.com/92905626/155857729-58a7751a-cb63-48ee-9df5-3a4ee4129a25.JPG) +# *GUIDE* + +
+You can run this voice assistant through an .exe file as well as through the terminal. When using it as an .exe file, be sure to keep the .exe file in its setup. + +

a) For using Voice Assistant through TERMINAL WINDOW

+ +1. All the pre-requisites should be complete to run the Voice Assistant in the terminal window. +1. Create a GitHub account if not created already. +2. The code is present in the file *Project_Basic_struct* +3. The source code can be downloaded using the following link: - + +This source code should be cloned using the git commands. + +For more information about cloning a GitHub repository, go to the following link - + +
After cloning the project, to use this project do the following :-
+$ Run the file VoiceAssistant\_main.py in the terminal using the command:- python VoiceAssistant\_main.py
+1. For more details about running a python code follow the link: - +1. For Windows - +1. For Linux - +1. For MacOS - + +

b) For using Voice Assistant through an EXECUTABLE (.exe) file

+ +Download - https://github.com/SohamRatnaparkhi/Voice-Assistant/releases/tag/v1.0.0 + +Download the rar file. + +1. Extract the folder. +2. Open VoiceAssistant folder. +3. Double-click on the file \_1\_VoiceAssistant for using it. + +In case, if you don't find \_1\_VoiceAssistant in the Voice Assistant folder, just install the executable(.exe) file AND SAVE IT IN VoiceAssistant FOLDER. **It is advisable to run the (.exe) file in the VoiceAssistant folder; else the file won't run.** + +

Using the Voice Assistant after installation of its resources

+ +- Saying "Hello Python" will activate the Voice Assistant. +- Then the table that will be displayed on the screen shows the tasks that Voice Assistant can do. +- Saying the respective commands of the task that is intended will enable the Voice Assistant to do those tasks. +- The README.md file of this repository has more information about the individual commands. + +![Voice Assistant](https://user-images.githubusercontent.com/92905626/155857729-58a7751a-cb63-48ee-9df5-3a4ee4129a25.JPG) diff --git a/VoiceAssistant/PRE-REQUISITES.md b/voiceassistant_1/PRE-REQUISITES.md similarity index 97% rename from VoiceAssistant/PRE-REQUISITES.md rename to voiceassistant_1/PRE-REQUISITES.md index 3cddcd3c2d1..6f26b2dd35f 100644 --- a/VoiceAssistant/PRE-REQUISITES.md +++ b/voiceassistant_1/PRE-REQUISITES.md @@ -1,40 +1,40 @@ -# *PRE-REQUISITES* - -Following are the pre-requisites to be installed in the system to use Voice Assistant through Terminal Window. - -1. Python3 should be installed in the system. -[Click to download](https://www.python.org/downloads/). - -1. Following libraries and packages are to be installed. The syntax for library [installation of a library and a package](https://packaging.python.org/en/latest/tutorials/installing-packages/) is: - - 1. pip install (library/package\_name) or - 1. pip3 install (library/package\_name) - -## *Enter the following commands to install them*: - - -[pip install colorama](https://pypi.org/project/colorama/) - -[](https://pypi.org/project/colorama/)[pip install rich](https://pypi.org/project/rich/) - -[pip install pyttsx3](https://pypi.org/project/pyttsx3/) - -[pip install DateTime](https://pypi.org/project/DateTime/) - -[pip install SpeechRecognition](https://pypi.org/project/SpeechRecognition/) - -[pip install docx](https://pypi.org/project/docx/) - -[pip install fitz](https://pypi.org/project/fitz/) - -[pip install gTTS](https://pypi.org/project/gTTS/) - -[pip install playsound](https://pypi.org/project/playsound/) - -[pip install pywin32](https://superuser.com/questions/609447/how-to-install-the-win32com-python-library) - -[pip install wikipedia](https://pypi.org/project/wikipedia/) - -[pip install webbrowser](https://docs.python.org/3/library/webbrowser.html) - -## To download the source code and executable file. - [link](https://github.com/SohamRatnaparkhi/Voice-Assistant/releases/tag/v1.0.0) - -To use the Voice Assistant through an executable file; download according to instructions mentioned in the installation part of [README](https://github.com/SohamRatnaparkhi/Voice-Assistant). +# *PRE-REQUISITES* + +Following are the pre-requisites to be installed in the system to use Voice Assistant through Terminal Window. + +1. Python3 should be installed in the system. +[Click to download](https://www.python.org/downloads/). + +1. Following libraries and packages are to be installed. The syntax for library [installation of a library and a package](https://packaging.python.org/en/latest/tutorials/installing-packages/) is: - + 1. pip install (library/package\_name) or + 1. pip3 install (library/package\_name) + +## *Enter the following commands to install them*: - + +[pip install colorama](https://pypi.org/project/colorama/) + +[](https://pypi.org/project/colorama/)[pip install rich](https://pypi.org/project/rich/) + +[pip install pyttsx3](https://pypi.org/project/pyttsx3/) + +[pip install DateTime](https://pypi.org/project/DateTime/) + +[pip install SpeechRecognition](https://pypi.org/project/SpeechRecognition/) + +[pip install docx](https://pypi.org/project/docx/) + +[pip install fitz](https://pypi.org/project/fitz/) + +[pip install gTTS](https://pypi.org/project/gTTS/) + +[pip install playsound](https://pypi.org/project/playsound/) + +[pip install pywin32](https://superuser.com/questions/609447/how-to-install-the-win32com-python-library) + +[pip install wikipedia](https://pypi.org/project/wikipedia/) + +[pip install webbrowser](https://docs.python.org/3/library/webbrowser.html) + +## To download the source code and executable file. - [link](https://github.com/SohamRatnaparkhi/Voice-Assistant/releases/tag/v1.0.0) + +To use the Voice Assistant through an executable file; download according to instructions mentioned in the installation part of [README](https://github.com/SohamRatnaparkhi/Voice-Assistant). diff --git a/VoiceAssistant/Project_Basic_struct/TextTospeech.py b/voiceassistant_1/Project_Basic_struct/TextTospeech.py similarity index 95% rename from VoiceAssistant/Project_Basic_struct/TextTospeech.py rename to voiceassistant_1/Project_Basic_struct/TextTospeech.py index 5c23af072e6..b9f1baf12f3 100644 --- a/VoiceAssistant/Project_Basic_struct/TextTospeech.py +++ b/voiceassistant_1/Project_Basic_struct/TextTospeech.py @@ -1,15 +1,15 @@ -from gtts import gTTS -from playsound import playsound -import win32com -from win32com import client -import os - -def tts(): - audio = 'speech.mp3' - language = 'en' - sentence = input("Enter the text to be spoken :- ") - - speaker = win32com.client.Dispatch("SAPI.SpVoice") - sp = speaker.Speak(sentence) - - +from gtts import gTTS +from playsound import playsound +import win32com +from win32com import client +import os + +def tts(): + audio = 'speech.mp3' + language = 'en' + sentence = input("Enter the text to be spoken :- ") + + speaker = win32com.client.Dispatch("SAPI.SpVoice") + sp = speaker.Speak(sentence) + + diff --git a/VoiceAssistant/Project_Basic_struct/VoiceAssistant_main.py b/voiceassistant_1/Project_Basic_struct/VoiceAssistant_main.py similarity index 96% rename from VoiceAssistant/Project_Basic_struct/VoiceAssistant_main.py rename to voiceassistant_1/Project_Basic_struct/VoiceAssistant_main.py index 1c2baf70897..796e9fd5308 100644 --- a/VoiceAssistant/Project_Basic_struct/VoiceAssistant_main.py +++ b/voiceassistant_1/Project_Basic_struct/VoiceAssistant_main.py @@ -1,78 +1,78 @@ -from speakListen import * -from websiteWork import * -from textRead import * -from dictator import * -from menu import * -from speechtotext import * -from TextTospeech import * - - -def main(): - start = 0 - end = 0 - if start == 0: - print("\nSay \"Hello Python\" to activate the Voice Assistant!") - start += 1 - while True: - - q = short_hear().lower() - if "close" in q: - greet("end") - exit(0) - if "hello python" in q: - greet("start") - print_menu() - while True: - - query = hear().lower() - if "close" in query: - greet("end") - end += 1 - return 0 - elif "text to speech" in query: - tts() - time.sleep(4) - - - elif "search on google" in query or "search google" in query or "google" in query: - google_search() - time.sleep(10) - - elif "search on wikipedia" in query or "search wikipedia" in query or "wikipedia" in query: - wiki_search() - time.sleep(10) - - elif "word" in query: - ms_word() - time.sleep(5) - - elif "book" in query: - pdf_read() - time.sleep(10) - - elif "speech to text" in query: - big_text() - time.sleep(5) - - else: - print("I could'nt understand what you just said!") - speak("I could'nt understand what you just said!") - - print("\nDo you want to continue? if yes then say " + Fore.YELLOW + "\"YES\"" + Fore.WHITE + " else say " + Fore.YELLOW + "\"CLOSE PYTHON\"") - speak("Do you want to continue? if yes then say YES else say CLOSE PYTHON") - qry = hear().lower() - if "yes" in qry: - print_menu() - elif "close" in qry: - greet("end") - return 0 - else: - speak("You didn't say a valid command. So I am continuing!") - continue - - elif "close" in q: - return 0 - else: - continue - -main() +from speakListen import * +from websiteWork import * +from textRead import * +from dictator import * +from menu import * +from speechtotext import * +from TextTospeech import * + + +def main(): + start = 0 + end = 0 + if start == 0: + print("\nSay \"Hello Python\" to activate the Voice Assistant!") + start += 1 + while True: + + q = short_hear().lower() + if "close" in q: + greet("end") + exit(0) + if "hello python" in q: + greet("start") + print_menu() + while True: + + query = hear().lower() + if "close" in query: + greet("end") + end += 1 + return 0 + elif "text to speech" in query: + tts() + time.sleep(4) + + + elif "search on google" in query or "search google" in query or "google" in query: + google_search() + time.sleep(10) + + elif "search on wikipedia" in query or "search wikipedia" in query or "wikipedia" in query: + wiki_search() + time.sleep(10) + + elif "word" in query: + ms_word() + time.sleep(5) + + elif "book" in query: + pdf_read() + time.sleep(10) + + elif "speech to text" in query: + big_text() + time.sleep(5) + + else: + print("I could'nt understand what you just said!") + speak("I could'nt understand what you just said!") + + print("\nDo you want to continue? if yes then say " + Fore.YELLOW + "\"YES\"" + Fore.WHITE + " else say " + Fore.YELLOW + "\"CLOSE PYTHON\"") + speak("Do you want to continue? if yes then say YES else say CLOSE PYTHON") + qry = hear().lower() + if "yes" in qry: + print_menu() + elif "close" in qry: + greet("end") + return 0 + else: + speak("You didn't say a valid command. So I am continuing!") + continue + + elif "close" in q: + return 0 + else: + continue + +main() diff --git a/VoiceAssistant/Project_Basic_struct/dictator.py b/voiceassistant_1/Project_Basic_struct/dictator.py similarity index 96% rename from VoiceAssistant/Project_Basic_struct/dictator.py rename to voiceassistant_1/Project_Basic_struct/dictator.py index f5cb71fb014..e2890777e6d 100644 --- a/VoiceAssistant/Project_Basic_struct/dictator.py +++ b/voiceassistant_1/Project_Basic_struct/dictator.py @@ -1,47 +1,47 @@ -# from speakListen import hear -# from speakListen import long_hear -from speakListen import * - -from colorama import Fore, Back, Style - -def big_text(): - print("By default, I will record your voice for 60 seconds.\nDo you want to change this default timing?") - speak("By default, I will record your voice for 60 seconds.\nDo you want to change this default timing?") - print(Fore.YELLOW + "Yes or No") - query = hear().lower() - - duration_time = 0 - - if "yes" in query or "es" in query or "ye" in query or "s" in query: - - print("Please enter the time(in seconds) for which I shall record your speech - ", end = '') - duration_time = int(input().strip()) - - print("\n") - else: - duration_time = 60 - speak(f"I will record for {duration_time} seconds!") - text = long_hear(duration_time) - print("\n" + Fore.LIGHTCYAN_EX + text) - -def colours(): - text = "Colour" - print(Fore.BLACK + text) - print(Fore.GREEN + text) - print(Fore.YELLOW + text) - print(Fore.RED + text) - print(Fore.BLUE + text) - print(Fore.MAGENTA + text) - print(Fore.CYAN + text) - print(Fore.WHITE + text) - print(Fore.LIGHTBLACK_EX + text) - print(Fore.LIGHTRED_EX + text) - print(Fore.LIGHTGREEN_EX + text) - print(Fore.LIGHTYELLOW_EX + text) - print(Fore.LIGHTBLUE_EX + text) - print(Fore.LIGHTMAGENTA_EX + text) - print(Fore.LIGHTCYAN_EX + text) - print(Fore.LIGHTWHITE_EX + text) - -#big_text() +# from speakListen import hear +# from speakListen import long_hear +from speakListen import * + +from colorama import Fore, Back, Style + +def big_text(): + print("By default, I will record your voice for 60 seconds.\nDo you want to change this default timing?") + speak("By default, I will record your voice for 60 seconds.\nDo you want to change this default timing?") + print(Fore.YELLOW + "Yes or No") + query = hear().lower() + + duration_time = 0 + + if "yes" in query or "es" in query or "ye" in query or "s" in query: + + print("Please enter the time(in seconds) for which I shall record your speech - ", end = '') + duration_time = int(input().strip()) + + print("\n") + else: + duration_time = 60 + speak(f"I will record for {duration_time} seconds!") + text = long_hear(duration_time) + print("\n" + Fore.LIGHTCYAN_EX + text) + +def colours(): + text = "Colour" + print(Fore.BLACK + text) + print(Fore.GREEN + text) + print(Fore.YELLOW + text) + print(Fore.RED + text) + print(Fore.BLUE + text) + print(Fore.MAGENTA + text) + print(Fore.CYAN + text) + print(Fore.WHITE + text) + print(Fore.LIGHTBLACK_EX + text) + print(Fore.LIGHTRED_EX + text) + print(Fore.LIGHTGREEN_EX + text) + print(Fore.LIGHTYELLOW_EX + text) + print(Fore.LIGHTBLUE_EX + text) + print(Fore.LIGHTMAGENTA_EX + text) + print(Fore.LIGHTCYAN_EX + text) + print(Fore.LIGHTWHITE_EX + text) + +#big_text() #colours() \ No newline at end of file diff --git a/VoiceAssistant/Project_Basic_struct/menu.py b/voiceassistant_1/Project_Basic_struct/menu.py similarity index 97% rename from VoiceAssistant/Project_Basic_struct/menu.py rename to voiceassistant_1/Project_Basic_struct/menu.py index 8512271c0d2..347c86974ae 100644 --- a/VoiceAssistant/Project_Basic_struct/menu.py +++ b/voiceassistant_1/Project_Basic_struct/menu.py @@ -1,27 +1,27 @@ -from rich.console import Console # pip3 install Rich -from rich.table import Table -from speakListen import * - - -def print_menu(): - """Display a table with list of tasks and their associated commands. - """ - speak("I can do the following") - table = Table(title="\nI can do the following :- ", show_lines = True) - - table.add_column("Sr. No.", style="cyan", no_wrap=True) - table.add_column("Task", style="yellow") - table.add_column("Command", justify="left", style="green") - - table.add_row("1", "Speak Text entered by User", "text to speech") - table.add_row("2", "Search anything on Google", "Search on Google") - table.add_row("3", "Search anything on Wikipedia", "Search on Wikipedia") - table.add_row("4", "Read a MS Word(docx) document", "Read MS Word document") - table.add_row("5", "Convert speech to text", "Convert speech to text") - table.add_row("6", "Read a book(PDF)", "Read a book ") - table.add_row("7", "Quit the program", "Python close") - - console = Console() - console.print(table) - +from rich.console import Console # pip3 install Rich +from rich.table import Table +from speakListen import * + + +def print_menu(): + """Display a table with list of tasks and their associated commands. + """ + speak("I can do the following") + table = Table(title="\nI can do the following :- ", show_lines = True) + + table.add_column("Sr. No.", style="cyan", no_wrap=True) + table.add_column("Task", style="yellow") + table.add_column("Command", justify="left", style="green") + + table.add_row("1", "Speak Text entered by User", "text to speech") + table.add_row("2", "Search anything on Google", "Search on Google") + table.add_row("3", "Search anything on Wikipedia", "Search on Wikipedia") + table.add_row("4", "Read a MS Word(docx) document", "Read MS Word document") + table.add_row("5", "Convert speech to text", "Convert speech to text") + table.add_row("6", "Read a book(PDF)", "Read a book ") + table.add_row("7", "Quit the program", "Python close") + + console = Console() + console.print(table) + #print_menu() \ No newline at end of file diff --git a/VoiceAssistant/Project_Basic_struct/speakListen.py b/voiceassistant_1/Project_Basic_struct/speakListen.py similarity index 97% rename from VoiceAssistant/Project_Basic_struct/speakListen.py rename to voiceassistant_1/Project_Basic_struct/speakListen.py index e16db721abb..b5e2c475889 100644 --- a/VoiceAssistant/Project_Basic_struct/speakListen.py +++ b/voiceassistant_1/Project_Basic_struct/speakListen.py @@ -1,169 +1,169 @@ -import time -from colorama import Fore, Back, Style -import speech_recognition as sr -import os -import pyttsx3 -import datetime -from rich.progress import Progress - - -python = pyttsx3.init("sapi5") # name of the engine is set as Python -voices = python.getProperty("voices") -#print(voices) -python.setProperty("voice", voices[1].id) -python.setProperty("rate", 140) - - -def speak(text): - """[This function would speak aloud some text provided as parameter] - - Args: - text ([str]): [It is the speech to be spoken] - """ - python.say(text) - python.runAndWait() - -def greet(g): - """Uses the datetime library to generate current time and then greets accordingly. - - - Args: - g (str): To decide whether to say hello or good bye - """ - if g == "start" or g == "s": - h = datetime.datetime.now().hour - text = '' - if h > 12 and h < 17: - text = "Hello ! Good Afternoon " - elif h < 12 and h > 0: - text = "Hello! Good Morning " - elif h >= 17 : - text = "Hello! Good Evening " - text += " I am Python, How may i help you ?" - speak(text) - - elif g == "quit" or g == "end" or g == "over" or g == "e": - text = 'Thank you!. Good Bye ! ' - speak(text) - -def hear(): - """[It will process the speech of user using Google_Speech_Recognizer(recognize_google)] - - Returns: - [str]: [Speech of user as a string in English(en - IN)] - """ - r = sr.Recognizer() - """Reconizer is a class which has lot of functions related to Speech i/p and o/p. - """ - r.pause_threshold = 1 # a pause of more than 1 second will stop the microphone temporarily - r.energy_threshold = 300 # python by default sets it to 300. It is the minimum input energy to be considered. - r.dynamic_energy_threshold = True # pyhton now can dynamically change the threshold energy - - with sr.Microphone() as source: - # read the audio data from the default microphone - print(Fore.RED + "\nListening...") - #time.sleep(0.5) - - speech = r.record(source, duration = 9) # option - #speech = r.listen(source) - # convert speech to text - try: - #print("Recognizing...") - recognizing() - speech = r.recognize_google(speech) - print(speech + "\n") - - except Exception as exception: - print(exception) - return "None" - return speech - -def recognizing(): - """Uses the Rich library to print a simulates version of "recognizing" by printing a loading bar. - """ - with Progress() as pr: - rec = pr.add_task("[red]Recognizing...", total = 100) - while not pr.finished: - pr.update(rec, advance = 1.0) - time.sleep(0.01) - -def long_hear(duration_time = 60): - """[It will process the speech of user using Google_Speech_Recognizer(recognize_google)] - the difference between the hear() and long_hear() is that - the - hear() - records users voice for 9 seconds - long_hear() - will record user's voice for the time specified by user. By default, it records for 60 seconds. - Returns: - [str]: [Speech of user as a string in English(en - IN)] - """ - r = sr.Recognizer() - """Reconizer is a class which has lot of functions related to Speech i/p and o/p. - """ - r.pause_threshold = 1 # a pause of more than 1 second will stop the microphone temporarily - r.energy_threshold = 300 # python by default sets it to 300. It is the minimum input energy to be considered. - r.dynamic_energy_threshold = True # pyhton now can dynamically change the threshold energy - - with sr.Microphone() as source: - # read the audio data from the default microphone - print(Fore.RED + "\nListening...") - #time.sleep(0.5) - - speech = r.record(source, duration = duration_time) # option - #speech = r.listen(source) - # convert speech to text - try: - print(Fore.RED +"Recognizing...") - #recognizing() - speech = r.recognize_google(speech) - #print(speech + "\n") - - except Exception as exception: - print(exception) - return "None" - return speech - -def short_hear(duration_time = 5): - """[It will process the speech of user using Google_Speech_Recognizer(recognize_google)] - the difference between the hear() and long_hear() is that - the - hear() - records users voice for 9 seconds - long_hear - will record user's voice for the time specified by user. By default, it records for 60 seconds. - Returns: - [str]: [Speech of user as a string in English(en - IN)] - """ - r = sr.Recognizer() - """Reconizer is a class which has lot of functions related to Speech i/p and o/p. - """ - r.pause_threshold = 1 # a pause of more than 1 second will stop the microphone temporarily - r.energy_threshold = 300 # python by default sets it to 300. It is the minimum input energy to be considered. - r.dynamic_energy_threshold = True # pyhton now can dynamically change the threshold energy - - with sr.Microphone() as source: - # read the audio data from the default microphone - print(Fore.RED + "\nListening...") - #time.sleep(0.5) - - speech = r.record(source, duration = duration_time) # option - #speech = r.listen(source) - # convert speech to text - try: - print(Fore.RED +"Recognizing...") - #recognizing() - speech = r.recognize_google(speech) - #print(speech + "\n") - - except Exception as exception: - print(exception) - return "None" - return speech - - - -if __name__ == '__main__': - # print("Enter your name") - # name = hear() - # speak("Hello " + name) - # greet("s") - # greet("e") - pass - #hear() - #recognizing() - +import time +from colorama import Fore, Back, Style +import speech_recognition as sr +import os +import pyttsx3 +import datetime +from rich.progress import Progress + + +python = pyttsx3.init("sapi5") # name of the engine is set as Python +voices = python.getProperty("voices") +#print(voices) +python.setProperty("voice", voices[1].id) +python.setProperty("rate", 140) + + +def speak(text): + """[This function would speak aloud some text provided as parameter] + + Args: + text ([str]): [It is the speech to be spoken] + """ + python.say(text) + python.runAndWait() + +def greet(g): + """Uses the datetime library to generate current time and then greets accordingly. + + + Args: + g (str): To decide whether to say hello or good bye + """ + if g == "start" or g == "s": + h = datetime.datetime.now().hour + text = '' + if h > 12 and h < 17: + text = "Hello ! Good Afternoon " + elif h < 12 and h > 0: + text = "Hello! Good Morning " + elif h >= 17 : + text = "Hello! Good Evening " + text += " I am Python, How may i help you ?" + speak(text) + + elif g == "quit" or g == "end" or g == "over" or g == "e": + text = 'Thank you!. Good Bye ! ' + speak(text) + +def hear(): + """[It will process the speech of user using Google_Speech_Recognizer(recognize_google)] + + Returns: + [str]: [Speech of user as a string in English(en - IN)] + """ + r = sr.Recognizer() + """Reconizer is a class which has lot of functions related to Speech i/p and o/p. + """ + r.pause_threshold = 1 # a pause of more than 1 second will stop the microphone temporarily + r.energy_threshold = 300 # python by default sets it to 300. It is the minimum input energy to be considered. + r.dynamic_energy_threshold = True # pyhton now can dynamically change the threshold energy + + with sr.Microphone() as source: + # read the audio data from the default microphone + print(Fore.RED + "\nListening...") + #time.sleep(0.5) + + speech = r.record(source, duration = 9) # option + #speech = r.listen(source) + # convert speech to text + try: + #print("Recognizing...") + recognizing() + speech = r.recognize_google(speech) + print(speech + "\n") + + except Exception as exception: + print(exception) + return "None" + return speech + +def recognizing(): + """Uses the Rich library to print a simulates version of "recognizing" by printing a loading bar. + """ + with Progress() as pr: + rec = pr.add_task("[red]Recognizing...", total = 100) + while not pr.finished: + pr.update(rec, advance = 1.0) + time.sleep(0.01) + +def long_hear(duration_time = 60): + """[It will process the speech of user using Google_Speech_Recognizer(recognize_google)] + the difference between the hear() and long_hear() is that - the + hear() - records users voice for 9 seconds + long_hear() - will record user's voice for the time specified by user. By default, it records for 60 seconds. + Returns: + [str]: [Speech of user as a string in English(en - IN)] + """ + r = sr.Recognizer() + """Reconizer is a class which has lot of functions related to Speech i/p and o/p. + """ + r.pause_threshold = 1 # a pause of more than 1 second will stop the microphone temporarily + r.energy_threshold = 300 # python by default sets it to 300. It is the minimum input energy to be considered. + r.dynamic_energy_threshold = True # pyhton now can dynamically change the threshold energy + + with sr.Microphone() as source: + # read the audio data from the default microphone + print(Fore.RED + "\nListening...") + #time.sleep(0.5) + + speech = r.record(source, duration = duration_time) # option + #speech = r.listen(source) + # convert speech to text + try: + print(Fore.RED +"Recognizing...") + #recognizing() + speech = r.recognize_google(speech) + #print(speech + "\n") + + except Exception as exception: + print(exception) + return "None" + return speech + +def short_hear(duration_time = 5): + """[It will process the speech of user using Google_Speech_Recognizer(recognize_google)] + the difference between the hear() and long_hear() is that - the + hear() - records users voice for 9 seconds + long_hear - will record user's voice for the time specified by user. By default, it records for 60 seconds. + Returns: + [str]: [Speech of user as a string in English(en - IN)] + """ + r = sr.Recognizer() + """Reconizer is a class which has lot of functions related to Speech i/p and o/p. + """ + r.pause_threshold = 1 # a pause of more than 1 second will stop the microphone temporarily + r.energy_threshold = 300 # python by default sets it to 300. It is the minimum input energy to be considered. + r.dynamic_energy_threshold = True # pyhton now can dynamically change the threshold energy + + with sr.Microphone() as source: + # read the audio data from the default microphone + print(Fore.RED + "\nListening...") + #time.sleep(0.5) + + speech = r.record(source, duration = duration_time) # option + #speech = r.listen(source) + # convert speech to text + try: + print(Fore.RED +"Recognizing...") + #recognizing() + speech = r.recognize_google(speech) + #print(speech + "\n") + + except Exception as exception: + print(exception) + return "None" + return speech + + + +if __name__ == '__main__': + # print("Enter your name") + # name = hear() + # speak("Hello " + name) + # greet("s") + # greet("e") + pass + #hear() + #recognizing() + diff --git a/VoiceAssistant/Project_Basic_struct/speechtotext.py b/voiceassistant_1/Project_Basic_struct/speechtotext.py similarity index 97% rename from VoiceAssistant/Project_Basic_struct/speechtotext.py rename to voiceassistant_1/Project_Basic_struct/speechtotext.py index 1b1974c8b79..b3a3f63a637 100644 --- a/VoiceAssistant/Project_Basic_struct/speechtotext.py +++ b/voiceassistant_1/Project_Basic_struct/speechtotext.py @@ -1,11 +1,11 @@ -import speech_recognition as sr -# initialize the recognizer -r = sr.Recognizer() -def stt(): - with sr.Microphone() as source: - # read the audio data from the default microphone - audio_data = r.record(source, duration=5) - print("Recognizing...") - # convert speech to text - text = r.recognize_google(audio_data) +import speech_recognition as sr +# initialize the recognizer +r = sr.Recognizer() +def stt(): + with sr.Microphone() as source: + # read the audio data from the default microphone + audio_data = r.record(source, duration=5) + print("Recognizing...") + # convert speech to text + text = r.recognize_google(audio_data) print(text) \ No newline at end of file diff --git a/VoiceAssistant/Project_Basic_struct/textRead.py b/voiceassistant_1/Project_Basic_struct/textRead.py similarity index 97% rename from VoiceAssistant/Project_Basic_struct/textRead.py rename to voiceassistant_1/Project_Basic_struct/textRead.py index 030c78501f0..07b5be316ff 100644 --- a/VoiceAssistant/Project_Basic_struct/textRead.py +++ b/voiceassistant_1/Project_Basic_struct/textRead.py @@ -1,298 +1,298 @@ -from speakListen import hear -from speakListen import speak -import docx -import fitz -import time -from rich.console import Console # pip3 install Rich -from rich.table import Table -from colorama import Fore - -def ms_word(): - """[Print and speak out a ms_word docx file as specified in the path] - """ - # TODO : Take location input from the user - try: - speak("Enter the document's location - ") - location = input("Enter the document's location - ") - - file_loc = doubleslash(location) - - doc = docx.Document(file_loc) - fullText = [] - for para in doc.paragraphs: - fullText.append(para.text) - #print(fullText) - doc_file = '\n'.join(fullText) - print(doc_file) - speak(doc_file) - except Exception as exp: - #print(exp) - print(f"ERROR - {exp}") - print(Fore.YELLOW + "I could'nt locate the file!\nIf you didn't specify the extension of the file, please specify it.") - return "None" - -def pdf_read(): - """[Print and speak out the pdf on specified path] - """ - try: - speak("Enter the document's location - ") - location = input("Enter the document's location - ") - - path = doubleslash(location) - pdf = fitz.open(path) - details = pdf.metadata # Stores the meta-data which generally includes Author name and Title of book/document. - total_pages = pdf.pageCount # Stores the total number of pages - - except Exception as exp: - print(f"ERROR - {exp}") - print(Fore.YELLOW + "I could'nt locate the file!\nIf you didn't specify the extension of the file, please specify it.") - return "None" - try : - """ 1. Author - 2. Creator - 3. Producer - 4. Title """ - - author = details["author"] - #print("Author : ",author) - - title = details["title"] - #print("Title : ",title) - - #print(details) - #print("Total Pages : ",total_pages) - book_details(author, title, total_pages) - speak(f" Title {title}") - speak(f" Author {author}") - speak(f" Total Pages {total_pages}") - - # TODO : Deal with the Index - toc = pdf.get_toc() - print("Say 1 or \"ONLY PRINT INDEX\" - if you want me to print the book's index.\nSay 2 if you want me to print and make me speak out the book's index.\nSay any key if you don't want to print the index.'") - speak("Say 1 or only print index if you want me to print the book's index.\nSay 2 if you want me to print and make me speak out the book's index.\nSay any key if you don't want to print the index.'") - q = hear().lower() - - if "only print" in q or "1" in q or "one" in q or "vone" in q or 'only' in q or "index only" in q or 'only' in q or "print only" in q: - print_index(toc) - time.sleep(15) - elif "speak" in q or "2" in q or 'two' in q: - print_n_speak_index(toc) - time.sleep(10) - elif q == "None": - print("I could'nt understand what you just said!") - speak("I could'nt understand what you just said!") - time.sleep(4) - else: - time.sleep(4) - pass - - - """Allow the user to do the following - 1. Read/speak a page - 2. Read/speak a range of pages - 3. Lesson - 4. Read/speak a whole book - """ - - #time.sleep(5) - - print("____________________________________________________________________________________________________________") - print("1. Print/speak a single page\n2. Print/speak a range of pages\n3. Print/speak a Lesson\n4. Read/speak a whole book") - speak("1. Print/speak a single page\n2. Print/speak a range of pages\n3. Print/speak a Lesson\n4. Read/speak a whole book") - q = hear().lower() - if "single" in q or "one" in q or "vone" in q or "one page" in q or "vone page" in q or "1 page" in q: - try: - pgno = int(input("Page Number - ")) - - page = pdf.load_page(pgno - 1) - text = page.get_text('text') - print("\n\n") - print(text.replace('\t',' ')) - speak(text.replace('\t',' ')) - except Exception: - print("Sorry, I could recognize what you entered. Please re-enter the Page Number.") - speak("Sorry, I could recognize what you entered. Please re-enter the Page Number.") - pgno = input("Page no. - ") - page = pdf.load_page(pgno - 1) - text = page.get_text('text') - print(text.replace('\t',' ')) - speak(text.replace('\t',' ')) - - - elif 'range' in q or "multiple" in q: - try: - start_pg_no = int(input("Starting Page Number - ")) - end_pg_no = int(input("End Page Number - ")) - for i in range(start_pg_no - 1, end_pg_no): - page = pdf.load_page(i) - text = page.get_text('text') - print(text.replace('\t',' ')) - speak(text.replace('\t',' ')) - except Exception: - print("Sorry, I could recognize what you entered. Please re-enter the Page Number.") - speak("Sorry, I could recognize what you entered. Please re-enter the Page Number.") - start_pg_no = int(input("Starting Page Number - ")) - end_pg_no = int(input("End Page Number - ")) - for i in range(start_pg_no - 1, end_pg_no - 1): - page = pdf.load_page(i) - text = page.get_text('text') - print(text.replace('\t',' ')) - speak(text.replace('\t',' ')) - - elif 'lesson' in q: - try: - key = input("Lesson name - ") - start_pg_no, end_pg_no = search_in_toc(toc, key, total_pages) - if start_pg_no != None and end_pg_no != None: - start_pg_no, end_pg_no = map(int,search_in_toc(toc, key, total_pages)) - - for i in range(start_pg_no - 1, end_pg_no): - page = pdf.load_page(i) - text = page.get_text('text') - print(text.replace('\t',' ')) - speak(text.replace('\t',' ')) - else: - print("Try Again.") - speak("Try Again.") - speak("Lesson name") - key = input("Lesson name - ") - start_pg_no, end_pg_no = map(int,search_in_toc(toc, key, total_pages)) - if start_pg_no != None and end_pg_no != None: - for i in range(start_pg_no - 1, end_pg_no): - page = pdf.load_page(i) - text = page.get_text('text') - print(text.replace('\t',' ')) - speak(text.replace('\t',' ')) - - except Exception: - print("Try Again! Lesson could not be found.") - speak("Try Again.Lesson could not be found") - speak("Lesson name") - key = input("Lesson name - ") - start_pg_no, end_pg_no = search_in_toc(toc, key, total_pages) - if start_pg_no != None and end_pg_no != None: - start_pg_no, end_pg_no = map(int,search_in_toc(toc, key, total_pages)) - - for i in range(start_pg_no - 1, end_pg_no): - page = pdf.load_page(i) - text = page.get_text('text') - print(text.replace('\t',' ')) - speak(text.replace('\t',' ')) - else: - print("Sorry, I cannot find the perticular lesson.") - speak("Sorry, I cannot find the perticular lesson.") - - elif "whole" in q or 'complete' in q: - for i in range(total_pages): - page = pdf.load_page(i) - text = page.get_text('text') - print(text.replace('\t',' ')) - speak(text.replace('\t',' ')) - - elif q == "None": - print("I could'nt understand what you just said!") - speak("I could'nt understand what you just said!") - else: - print("You didn't say a valid command!") - time.sleep(5) - except Exception as e: - print(e) - pass - pdf.close() - -def doubleslash(text): - """Replaces / with // - - Args: - text (str): location - - Returns: - str: formatted location - """ - return text.replace('\\' , '\\\\') - -def print_index(toc): - """Prints out the index in proper format with title name and page number - - Args: - toc (nested list): toc[1] - Topic name - toc[2] - Page number - """ - dash = "-"*(100 - 7) - space = " "*47 - print(f"{space}INDEX") - print(f"\n\nName : {dash} PageNo.\n\n\n") - for topic in toc: - eq_dash = "-"*(100 - len(topic[1])) - print(f"{topic[1]} {eq_dash} {topic[2]}") - -def print_n_speak_index(toc): - """Along with printing, it speaks out the index too. - - Args: - toc (nested list): toc[1] - Topic name - toc[2] - Page number - """ - dash = "-"*(100 - 7) - space = " "*47 - print(f"{space}INDEX") - print(f"\n\nName : {dash} PageNo.\n\n\n\n") - for topic in toc: - eq_dash = "-"*(100 - len(topic[1])) - print(f"{topic[1]} {eq_dash} {topic[2]}") - speak(f"{topic[1]} {topic[2]}") - -def search_in_toc(toc, key, totalpg): - """Searches a particular lesson name provided as a parameter in toc and returns its starting and ending page numbers. - - Args: - toc (nested list): toc[1] - Topic name - toc[2] - Page number - key (str): the key to be found - totalpg (int): total pages in book/document - - Returns: - int: staring and ending page numbers of lesson found. - If not found then return None - """ - for i in range(len(toc) - 1): - topic = toc[i] - if i != len(toc) - 2: - if topic[1] == key: - nexttopic = toc[i + 1] - return (topic[2], nexttopic[2]) - elif topic[1].lower() == key: - nexttopic = toc[i + 1] - return (topic[2], nexttopic[2]) - else: - if topic[1] == key: - return (topic[2], totalpg) - elif topic[1].lower() == key: - - return (topic[2], totalpg) - return None,None - -def book_details(author, title, total_pages): - """Creates a table of book details like author name, title, and total pages. - - Args: - author (str): Name of author - title (str): title of the book - total_pages (int): total pages in the book - """ - table = Table(title="\nBook Details :- ", show_lines = True) - - table.add_column("Sr. No.", style="magenta", no_wrap=True) - table.add_column("Property", style="cyan") - table.add_column("Value", justify="left", style="green") - - table.add_row("1", "Title", f"{title}") - table.add_row("2", "Author", f"{author}") - table.add_row("3", "Pages", f"{total_pages}") - - console = Console() - console.print(table) - -#ms_word() -#pdf_read() -#book_details("abc", "abcde", 12) +from speakListen import hear +from speakListen import speak +import docx +import fitz +import time +from rich.console import Console # pip3 install Rich +from rich.table import Table +from colorama import Fore + +def ms_word(): + """[Print and speak out a ms_word docx file as specified in the path] + """ + # TODO : Take location input from the user + try: + speak("Enter the document's location - ") + location = input("Enter the document's location - ") + + file_loc = doubleslash(location) + + doc = docx.Document(file_loc) + fullText = [] + for para in doc.paragraphs: + fullText.append(para.text) + #print(fullText) + doc_file = '\n'.join(fullText) + print(doc_file) + speak(doc_file) + except Exception as exp: + #print(exp) + print(f"ERROR - {exp}") + print(Fore.YELLOW + "I could'nt locate the file!\nIf you didn't specify the extension of the file, please specify it.") + return "None" + +def pdf_read(): + """[Print and speak out the pdf on specified path] + """ + try: + speak("Enter the document's location - ") + location = input("Enter the document's location - ") + + path = doubleslash(location) + pdf = fitz.open(path) + details = pdf.metadata # Stores the meta-data which generally includes Author name and Title of book/document. + total_pages = pdf.pageCount # Stores the total number of pages + + except Exception as exp: + print(f"ERROR - {exp}") + print(Fore.YELLOW + "I could'nt locate the file!\nIf you didn't specify the extension of the file, please specify it.") + return "None" + try : + """ 1. Author + 2. Creator + 3. Producer + 4. Title """ + + author = details["author"] + #print("Author : ",author) + + title = details["title"] + #print("Title : ",title) + + #print(details) + #print("Total Pages : ",total_pages) + book_details(author, title, total_pages) + speak(f" Title {title}") + speak(f" Author {author}") + speak(f" Total Pages {total_pages}") + + # TODO : Deal with the Index + toc = pdf.get_toc() + print("Say 1 or \"ONLY PRINT INDEX\" - if you want me to print the book's index.\nSay 2 if you want me to print and make me speak out the book's index.\nSay any key if you don't want to print the index.'") + speak("Say 1 or only print index if you want me to print the book's index.\nSay 2 if you want me to print and make me speak out the book's index.\nSay any key if you don't want to print the index.'") + q = hear().lower() + + if "only print" in q or "1" in q or "one" in q or "vone" in q or 'only' in q or "index only" in q or 'only' in q or "print only" in q: + print_index(toc) + time.sleep(15) + elif "speak" in q or "2" in q or 'two' in q: + print_n_speak_index(toc) + time.sleep(10) + elif q == "None": + print("I could'nt understand what you just said!") + speak("I could'nt understand what you just said!") + time.sleep(4) + else: + time.sleep(4) + pass + + + """Allow the user to do the following + 1. Read/speak a page + 2. Read/speak a range of pages + 3. Lesson + 4. Read/speak a whole book + """ + + #time.sleep(5) + + print("____________________________________________________________________________________________________________") + print("1. Print/speak a single page\n2. Print/speak a range of pages\n3. Print/speak a Lesson\n4. Read/speak a whole book") + speak("1. Print/speak a single page\n2. Print/speak a range of pages\n3. Print/speak a Lesson\n4. Read/speak a whole book") + q = hear().lower() + if "single" in q or "one" in q or "vone" in q or "one page" in q or "vone page" in q or "1 page" in q: + try: + pgno = int(input("Page Number - ")) + + page = pdf.load_page(pgno - 1) + text = page.get_text('text') + print("\n\n") + print(text.replace('\t',' ')) + speak(text.replace('\t',' ')) + except Exception: + print("Sorry, I could recognize what you entered. Please re-enter the Page Number.") + speak("Sorry, I could recognize what you entered. Please re-enter the Page Number.") + pgno = input("Page no. - ") + page = pdf.load_page(pgno - 1) + text = page.get_text('text') + print(text.replace('\t',' ')) + speak(text.replace('\t',' ')) + + + elif 'range' in q or "multiple" in q: + try: + start_pg_no = int(input("Starting Page Number - ")) + end_pg_no = int(input("End Page Number - ")) + for i in range(start_pg_no - 1, end_pg_no): + page = pdf.load_page(i) + text = page.get_text('text') + print(text.replace('\t',' ')) + speak(text.replace('\t',' ')) + except Exception: + print("Sorry, I could recognize what you entered. Please re-enter the Page Number.") + speak("Sorry, I could recognize what you entered. Please re-enter the Page Number.") + start_pg_no = int(input("Starting Page Number - ")) + end_pg_no = int(input("End Page Number - ")) + for i in range(start_pg_no - 1, end_pg_no - 1): + page = pdf.load_page(i) + text = page.get_text('text') + print(text.replace('\t',' ')) + speak(text.replace('\t',' ')) + + elif 'lesson' in q: + try: + key = input("Lesson name - ") + start_pg_no, end_pg_no = search_in_toc(toc, key, total_pages) + if start_pg_no != None and end_pg_no != None: + start_pg_no, end_pg_no = map(int,search_in_toc(toc, key, total_pages)) + + for i in range(start_pg_no - 1, end_pg_no): + page = pdf.load_page(i) + text = page.get_text('text') + print(text.replace('\t',' ')) + speak(text.replace('\t',' ')) + else: + print("Try Again.") + speak("Try Again.") + speak("Lesson name") + key = input("Lesson name - ") + start_pg_no, end_pg_no = map(int,search_in_toc(toc, key, total_pages)) + if start_pg_no != None and end_pg_no != None: + for i in range(start_pg_no - 1, end_pg_no): + page = pdf.load_page(i) + text = page.get_text('text') + print(text.replace('\t',' ')) + speak(text.replace('\t',' ')) + + except Exception: + print("Try Again! Lesson could not be found.") + speak("Try Again.Lesson could not be found") + speak("Lesson name") + key = input("Lesson name - ") + start_pg_no, end_pg_no = search_in_toc(toc, key, total_pages) + if start_pg_no != None and end_pg_no != None: + start_pg_no, end_pg_no = map(int,search_in_toc(toc, key, total_pages)) + + for i in range(start_pg_no - 1, end_pg_no): + page = pdf.load_page(i) + text = page.get_text('text') + print(text.replace('\t',' ')) + speak(text.replace('\t',' ')) + else: + print("Sorry, I cannot find the perticular lesson.") + speak("Sorry, I cannot find the perticular lesson.") + + elif "whole" in q or 'complete' in q: + for i in range(total_pages): + page = pdf.load_page(i) + text = page.get_text('text') + print(text.replace('\t',' ')) + speak(text.replace('\t',' ')) + + elif q == "None": + print("I could'nt understand what you just said!") + speak("I could'nt understand what you just said!") + else: + print("You didn't say a valid command!") + time.sleep(5) + except Exception as e: + print(e) + pass + pdf.close() + +def doubleslash(text): + """Replaces / with // + + Args: + text (str): location + + Returns: + str: formatted location + """ + return text.replace('\\' , '\\\\') + +def print_index(toc): + """Prints out the index in proper format with title name and page number + + Args: + toc (nested list): toc[1] - Topic name + toc[2] - Page number + """ + dash = "-"*(100 - 7) + space = " "*47 + print(f"{space}INDEX") + print(f"\n\nName : {dash} PageNo.\n\n\n") + for topic in toc: + eq_dash = "-"*(100 - len(topic[1])) + print(f"{topic[1]} {eq_dash} {topic[2]}") + +def print_n_speak_index(toc): + """Along with printing, it speaks out the index too. + + Args: + toc (nested list): toc[1] - Topic name + toc[2] - Page number + """ + dash = "-"*(100 - 7) + space = " "*47 + print(f"{space}INDEX") + print(f"\n\nName : {dash} PageNo.\n\n\n\n") + for topic in toc: + eq_dash = "-"*(100 - len(topic[1])) + print(f"{topic[1]} {eq_dash} {topic[2]}") + speak(f"{topic[1]} {topic[2]}") + +def search_in_toc(toc, key, totalpg): + """Searches a particular lesson name provided as a parameter in toc and returns its starting and ending page numbers. + + Args: + toc (nested list): toc[1] - Topic name + toc[2] - Page number + key (str): the key to be found + totalpg (int): total pages in book/document + + Returns: + int: staring and ending page numbers of lesson found. + If not found then return None + """ + for i in range(len(toc) - 1): + topic = toc[i] + if i != len(toc) - 2: + if topic[1] == key: + nexttopic = toc[i + 1] + return (topic[2], nexttopic[2]) + elif topic[1].lower() == key: + nexttopic = toc[i + 1] + return (topic[2], nexttopic[2]) + else: + if topic[1] == key: + return (topic[2], totalpg) + elif topic[1].lower() == key: + + return (topic[2], totalpg) + return None,None + +def book_details(author, title, total_pages): + """Creates a table of book details like author name, title, and total pages. + + Args: + author (str): Name of author + title (str): title of the book + total_pages (int): total pages in the book + """ + table = Table(title="\nBook Details :- ", show_lines = True) + + table.add_column("Sr. No.", style="magenta", no_wrap=True) + table.add_column("Property", style="cyan") + table.add_column("Value", justify="left", style="green") + + table.add_row("1", "Title", f"{title}") + table.add_row("2", "Author", f"{author}") + table.add_row("3", "Pages", f"{total_pages}") + + console = Console() + console.print(table) + +#ms_word() +#pdf_read() +#book_details("abc", "abcde", 12) diff --git a/VoiceAssistant/Project_Basic_struct/websiteWork.py b/voiceassistant_1/Project_Basic_struct/websiteWork.py similarity index 96% rename from VoiceAssistant/Project_Basic_struct/websiteWork.py rename to voiceassistant_1/Project_Basic_struct/websiteWork.py index c20a2792791..3b90e4cb7bb 100644 --- a/VoiceAssistant/Project_Basic_struct/websiteWork.py +++ b/voiceassistant_1/Project_Basic_struct/websiteWork.py @@ -1,62 +1,62 @@ -from speakListen import greet, hear -from speakListen import speak - - -""" 1. speakListen.speak(text) - 2. speakListen.greet() - 3. speakListen.hear() -""" -import wikipedia -import webbrowser - - -def google_search(): - """[Goes to google and searches the website asked by the user] - """ - google_search_link = "https://www.google.co.in/search?q=" - google_search = "What do you want me to search on Google? " - print(google_search) - speak(google_search) - - query = hear() - - if query != "None": - webbrowser.open(google_search_link+query) - elif query == "None": - print("I could'nt understand what you just said!") - speak("I could'nt understand what you just said!") - -def wiki_search(): - """[Speak out the summary in wikipedia and going to the website according to user's choice.] - """ - wiki_search = "What do you want me to search on Wikipedia? Please tell me the exact sentence or word to Search." - wiki_search_link = "https://en.wikipedia.org/wiki/" - - print(wiki_search) - speak(wiki_search) - - query = hear() - try: - - if query != "None": - results = wikipedia.summary(query, sentences = 2) - print(results) - speak(results) - - print("Do you want me to open the Wikipedia page?") - speak("Do you want me to open the Wikipedia page?") - q = hear().lower() - - if "yes" in q or "okay" in q or "ok" in q or "opun" in q or "opan" in q or "vopen" in q or "es" in q or "s" in q: - print(wiki_search_link + query) - webbrowser.open(wiki_search_link + query) - - elif query == "None": - print("I could'nt understand what you just said!") - speak("I could'nt understand what you just said!") - - except Exception as e: - print("Couldn't find") - -#wiki_search() -#google_search() +from speakListen import greet, hear +from speakListen import speak + + +""" 1. speakListen.speak(text) + 2. speakListen.greet() + 3. speakListen.hear() +""" +import wikipedia +import webbrowser + + +def google_search(): + """[Goes to google and searches the website asked by the user] + """ + google_search_link = "https://www.google.co.in/search?q=" + google_search = "What do you want me to search on Google? " + print(google_search) + speak(google_search) + + query = hear() + + if query != "None": + webbrowser.open(google_search_link+query) + elif query == "None": + print("I could'nt understand what you just said!") + speak("I could'nt understand what you just said!") + +def wiki_search(): + """[Speak out the summary in wikipedia and going to the website according to user's choice.] + """ + wiki_search = "What do you want me to search on Wikipedia? Please tell me the exact sentence or word to Search." + wiki_search_link = "https://en.wikipedia.org/wiki/" + + print(wiki_search) + speak(wiki_search) + + query = hear() + try: + + if query != "None": + results = wikipedia.summary(query, sentences = 2) + print(results) + speak(results) + + print("Do you want me to open the Wikipedia page?") + speak("Do you want me to open the Wikipedia page?") + q = hear().lower() + + if "yes" in q or "okay" in q or "ok" in q or "opun" in q or "opan" in q or "vopen" in q or "es" in q or "s" in q: + print(wiki_search_link + query) + webbrowser.open(wiki_search_link + query) + + elif query == "None": + print("I could'nt understand what you just said!") + speak("I could'nt understand what you just said!") + + except Exception as e: + print("Couldn't find") + +#wiki_search() +#google_search() diff --git a/VoiceAssistant/README.md b/voiceassistant_1/README.md similarity index 97% rename from VoiceAssistant/README.md rename to voiceassistant_1/README.md index 7e7fb7b5d22..36375fe47c0 100644 --- a/VoiceAssistant/README.md +++ b/voiceassistant_1/README.md @@ -1,96 +1,96 @@ - -# Voice Assistant -📑Website - https://sohamratnaparkhi.github.io/VoiceAssistant/ -
-🎇Please open the Project_Basic_struct folder to view the code!
-
-![VA](https://user-images.githubusercontent.com/92905626/155858792-9a217c3c-09dd-45ba-a952-f5799c0219d3.jpeg) - -This is Voice Assistant coded using Python which can do the following: - - - 1. Speak Text entered by User. - 2. Search anything on Google. - 3. Search anything on Wikipedia. - 4. Read a MS Word(docx) document. - 5. Convert speech to text. - 6. Read a book(PDF). - - - - -## Author - -- [@SohamRatnaparkhi](https://github.com/SohamRatnaparkhi) - - -### Table of Contents -- [Installation](#installation) -- [How To Use](#how-to-use) -- [Description of Commands](#description-of-commands) -- [Tech used](#tech-used) -- [Methodolgy](#methodolgy) - -## Installation -Download - https://github.com/SohamRatnaparkhi/Voice-Assistant/releases/tag/v1.0.0 - -Download the rar file. - - 1. Extract the folder. - 2. Open VoiceAssistant folder. - 3. Double-click on the file _1_VoiceAssistant for using it. -In-case, if you don't find _1_VoiceAssistant in Voice Assistant folder, just install the executable(.exe) file AND SAVE IT IN VoiceAssistant FOLDER. It is advisable to run the (.exe) file in the VoiceAssistant folder; else the file won't run. -## How To Use -- Saying "Hello Python" will activate the Voice Assistant. -- Then the table that will be displayed on the screen shows the tasks that Voice Assistant can do. -- Saying the respective commands of the task that is intended will enable the Voice Assistant to do those tasks. -## Screenshots - -![Voice Assistant](https://user-images.githubusercontent.com/92905626/155857729-58a7751a-cb63-48ee-9df5-3a4ee4129a25.JPG) - - - -## Description of Commands -1. text to speech - User needs to type the text and then it will be spoken by the VoiceAssistant. -2. Search on Google - Voice Assistant will ask you "What do you want me to search on Google". - - >Voice Assistant then starts recording your voice and will record anything that is spoken henceforth. - >Then it will open the search results in default browser. -3. Search on Wikipedia - Voice Assistant will ask you "What do you want me to search on Wikipwedia? please say the exactsentence or word to search.". - - >Voice Assistant then starts recording your voice and will record anything that is spoken henceforth. - >Then it will speak out and print the summary of the search results. - >It then asks, whether the respective search result should be opened in the default browser. - -4. Read MS word document - Asks user to enter the location of file to be read and reads it. - - NOTE :- - 1. A file location without an extension(i.e. '.docx') will give an error. - 2. A file inside a third party folder(Ex OneDrive) can't be accessed and will give an error. - -5. Convert speech to text - Prints out the speech spoken by user. - - By default, it record the voice for 60 seconds but it can be changed. - -6. Read a book - Asks user to enter the location of file to be read and reads it. - - NOTE :- - 1. A file location without an extension(i.e. '.pdf') will give an error. - 2. A file inside a third party folder(Ex. OneDrive) can't be accessed and will give an error. - -## Tech Used - -**Language:** Python - - - - -## Methodolgy -![VA Methodolgy](https://user-images.githubusercontent.com/92905626/155858712-c0274bc3-03c7-47de-bb7f-c4a2989144c6.JPG) - -For more information, follow the given links -

- https://github.com/SohamRatnaparkhi/Voice-Assistant/blob/master/DOCUMENTATION.md
- https://github.com/SohamRatnaparkhi/Voice-Assistant/blob/master/GUIDE.md
- https://github.com/SohamRatnaparkhi/Voice-Assistant/blob/master/PRE-REQUISITES.md
- - - THANK YOU! + +# Voice Assistant +📑Website - https://sohamratnaparkhi.github.io/VoiceAssistant/ +
+🎇Please open the Project_Basic_struct folder to view the code!
+
+![VA](https://user-images.githubusercontent.com/92905626/155858792-9a217c3c-09dd-45ba-a952-f5799c0219d3.jpeg) + +This is Voice Assistant coded using Python which can do the following: - + + 1. Speak Text entered by User. + 2. Search anything on Google. + 3. Search anything on Wikipedia. + 4. Read a MS Word(docx) document. + 5. Convert speech to text. + 6. Read a book(PDF). + + + + +## Author + +- [@SohamRatnaparkhi](https://github.com/SohamRatnaparkhi) + + +### Table of Contents +- [Installation](#installation) +- [How To Use](#how-to-use) +- [Description of Commands](#description-of-commands) +- [Tech used](#tech-used) +- [Methodolgy](#methodolgy) + +## Installation +Download - https://github.com/SohamRatnaparkhi/Voice-Assistant/releases/tag/v1.0.0 + +Download the rar file. + + 1. Extract the folder. + 2. Open VoiceAssistant folder. + 3. Double-click on the file _1_VoiceAssistant for using it. +In-case, if you don't find _1_VoiceAssistant in Voice Assistant folder, just install the executable(.exe) file AND SAVE IT IN VoiceAssistant FOLDER. It is advisable to run the (.exe) file in the VoiceAssistant folder; else the file won't run. +## How To Use +- Saying "Hello Python" will activate the Voice Assistant. +- Then the table that will be displayed on the screen shows the tasks that Voice Assistant can do. +- Saying the respective commands of the task that is intended will enable the Voice Assistant to do those tasks. +## Screenshots + +![Voice Assistant](https://user-images.githubusercontent.com/92905626/155857729-58a7751a-cb63-48ee-9df5-3a4ee4129a25.JPG) + + + +## Description of Commands +1. text to speech - User needs to type the text and then it will be spoken by the VoiceAssistant. +2. Search on Google - Voice Assistant will ask you "What do you want me to search on Google". + + >Voice Assistant then starts recording your voice and will record anything that is spoken henceforth. + >Then it will open the search results in default browser. +3. Search on Wikipedia - Voice Assistant will ask you "What do you want me to search on Wikipwedia? please say the exactsentence or word to search.". + + >Voice Assistant then starts recording your voice and will record anything that is spoken henceforth. + >Then it will speak out and print the summary of the search results. + >It then asks, whether the respective search result should be opened in the default browser. + +4. Read MS word document - Asks user to enter the location of file to be read and reads it. + + NOTE :- + 1. A file location without an extension(i.e. '.docx') will give an error. + 2. A file inside a third party folder(Ex OneDrive) can't be accessed and will give an error. + +5. Convert speech to text - Prints out the speech spoken by user. + + By default, it record the voice for 60 seconds but it can be changed. + +6. Read a book - Asks user to enter the location of file to be read and reads it. + + NOTE :- + 1. A file location without an extension(i.e. '.pdf') will give an error. + 2. A file inside a third party folder(Ex. OneDrive) can't be accessed and will give an error. + +## Tech Used + +**Language:** Python + + + + +## Methodolgy +![VA Methodolgy](https://user-images.githubusercontent.com/92905626/155858712-c0274bc3-03c7-47de-bb7f-c4a2989144c6.JPG) + +For more information, follow the given links -

+ https://github.com/SohamRatnaparkhi/Voice-Assistant/blob/master/DOCUMENTATION.md
+ https://github.com/SohamRatnaparkhi/Voice-Assistant/blob/master/GUIDE.md
+ https://github.com/SohamRatnaparkhi/Voice-Assistant/blob/master/PRE-REQUISITES.md
+ + + THANK YOU! diff --git a/VoiceRepeater/__main__.py b/voicerepeater_1/__main__.py similarity index 100% rename from VoiceRepeater/__main__.py rename to voicerepeater_1/__main__.py diff --git a/VoiceRepeater/readme.md b/voicerepeater_1/readme.md similarity index 100% rename from VoiceRepeater/readme.md rename to voicerepeater_1/readme.md diff --git a/vowel remover function.py b/vowel_remover_function.py similarity index 100% rename from vowel remover function.py rename to vowel_remover_function.py diff --git a/Weather Scrapper/weather.csv b/weather_scrapper/weather.csv similarity index 99% rename from Weather Scrapper/weather.csv rename to weather_scrapper/weather.csv index 4c067e23621..b17503481d1 100644 --- a/Weather Scrapper/weather.csv +++ b/weather_scrapper/weather.csv @@ -1,8 +1,8 @@ -City,Time,Date,Temperature,Precipitation,Sky,Wind -Manhatten,07:02,Tue 06/05,Low 71 F,Precipitate:30%,Isolated Thunderstorms,Winds light and variable -Manhattan,07:03,Wed 06/06,Low 47 F,Precipitate:10%,Partly Cloudy,Winds NE at 10 to 15 mph -Aligarh,07:03,Wed 06/06,High 109 F,Precipitate:20%,Partly Cloudy,Winds ENE at 10 to 15 mph -Delhi,07:03,Wed 06/06,High 107 F,Precipitate:40%,AM Thunderstorms,Winds E at 10 to 15 mph -Portland,02:20,Aug-21-2022,Low 61F,Precipitation:3%,A few clouds,Winds light and variable. -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 -Guadalajara,02:21,Aug-21-2022,Scattered thunderstorms developing this afternoon,Precipitation:52%,Mostly cloudy this morning,High near 80F +City,Time,Date,Temperature,Precipitation,Sky,Wind +Manhatten,07:02,Tue 06/05,Low 71 F,Precipitate:30%,Isolated Thunderstorms,Winds light and variable +Manhattan,07:03,Wed 06/06,Low 47 F,Precipitate:10%,Partly Cloudy,Winds NE at 10 to 15 mph +Aligarh,07:03,Wed 06/06,High 109 F,Precipitate:20%,Partly Cloudy,Winds ENE at 10 to 15 mph +Delhi,07:03,Wed 06/06,High 107 F,Precipitate:40%,AM Thunderstorms,Winds E at 10 to 15 mph +Portland,02:20,Aug-21-2022,Low 61F,Precipitation:3%,A few clouds,Winds light and variable. +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 +Guadalajara,02:21,Aug-21-2022,Scattered thunderstorms developing this afternoon,Precipitation:52%,Mostly cloudy this morning,High near 80F diff --git a/Weather Scrapper/weather.py b/weather_scrapper/weather.py similarity index 100% rename from Weather Scrapper/weather.py rename to weather_scrapper/weather.py diff --git a/WeatherGUI.py b/weathergui_1.py similarity index 97% rename from WeatherGUI.py rename to weathergui_1.py index 19b42994b84..945d724e540 100644 --- a/WeatherGUI.py +++ b/weathergui_1.py @@ -1,64 +1,64 @@ -import tkinter as tk -import requests -from bs4 import BeautifulSoup - -url = "https://weather.com/en-IN/weather/today/l/32355ced66b7ce3ab7ccafb0a4f45f12e7c915bcf8454f712efa57474ba8d6c8" - -root = tk.Tk() -root.title("Weather") -root.config(bg="white") - - -def getWeather(): - page = requests.get(url) - soup = BeautifulSoup(page.content, "html.parser") - location = soup.find("h1", class_="_1Ayv3").text - temperature = soup.find("span", class_="_3KcTQ").text - airquality = soup.find("text", class_="k2Z7I").text - airqualitytitle = soup.find("span", class_="_1VMr2").text - sunrise = soup.find("div", class_="_2ATeV").text - sunset = soup.find("div", class_="_2_gJb _2ATeV").text - # humidity = soup.find('div',class_='_23DP5').text - wind = soup.find("span", class_="_1Va1P undefined").text - pressure = soup.find("span", class_="_3olKd undefined").text - locationlabel.config(text=(location)) - templabel.config(text=temperature + "C") - WeatherText = ( - "Sunrise : " - + sunrise - + "\n" - + "SunSet : " - + sunset - + "\n" - + "Pressure : " - + pressure - + "\n" - + "Wind : " - + wind - + "\n" - ) - weatherPrediction.config(text=WeatherText) - airqualityText = airquality + " " * 5 + airqualitytitle + "\n" - airqualitylabel.config(text=airqualityText) - - weatherPrediction.after(120000, getWeather) - root.update() - - -locationlabel = tk.Label(root, font=("Calibri bold", 20), bg="white") -locationlabel.grid(row=0, column=1, sticky="N", padx=20, pady=40) - -templabel = tk.Label(root, font=("Caliber bold", 40), bg="white") -templabel.grid(row=0, column=0, sticky="W", padx=17) - -weatherPrediction = tk.Label(root, font=("Caliber", 15), bg="white") -weatherPrediction.grid(row=2, column=1, sticky="W", padx=40) - -tk.Label(root, text="Air Quality", font=("Calibri bold", 20), bg="white").grid( - row=1, column=2, sticky="W", padx=20 -) -airqualitylabel = tk.Label(root, font=("Caliber bold", 20), bg="white") -airqualitylabel.grid(row=2, column=2, sticky="W") - -getWeather() -root.mainloop() +import tkinter as tk +import requests +from bs4 import BeautifulSoup + +url = "https://weather.com/en-IN/weather/today/l/32355ced66b7ce3ab7ccafb0a4f45f12e7c915bcf8454f712efa57474ba8d6c8" + +root = tk.Tk() +root.title("Weather") +root.config(bg="white") + + +def getWeather(): + page = requests.get(url) + soup = BeautifulSoup(page.content, "html.parser") + location = soup.find("h1", class_="_1Ayv3").text + temperature = soup.find("span", class_="_3KcTQ").text + airquality = soup.find("text", class_="k2Z7I").text + airqualitytitle = soup.find("span", class_="_1VMr2").text + sunrise = soup.find("div", class_="_2ATeV").text + sunset = soup.find("div", class_="_2_gJb _2ATeV").text + # humidity = soup.find('div',class_='_23DP5').text + wind = soup.find("span", class_="_1Va1P undefined").text + pressure = soup.find("span", class_="_3olKd undefined").text + locationlabel.config(text=(location)) + templabel.config(text=temperature + "C") + WeatherText = ( + "Sunrise : " + + sunrise + + "\n" + + "SunSet : " + + sunset + + "\n" + + "Pressure : " + + pressure + + "\n" + + "Wind : " + + wind + + "\n" + ) + weatherPrediction.config(text=WeatherText) + airqualityText = airquality + " " * 5 + airqualitytitle + "\n" + airqualitylabel.config(text=airqualityText) + + weatherPrediction.after(120000, getWeather) + root.update() + + +locationlabel = tk.Label(root, font=("Calibri bold", 20), bg="white") +locationlabel.grid(row=0, column=1, sticky="N", padx=20, pady=40) + +templabel = tk.Label(root, font=("Caliber bold", 40), bg="white") +templabel.grid(row=0, column=0, sticky="W", padx=17) + +weatherPrediction = tk.Label(root, font=("Caliber", 15), bg="white") +weatherPrediction.grid(row=2, column=1, sticky="W", padx=40) + +tk.Label(root, text="Air Quality", font=("Calibri bold", 20), bg="white").grid( + row=1, column=2, sticky="W", padx=20 +) +airqualitylabel = tk.Label(root, font=("Caliber bold", 20), bg="white") +airqualitylabel.grid(row=2, column=2, sticky="W") + +getWeather() +root.mainloop() diff --git a/Web_Scraper.py b/web_scraper_1.py similarity index 100% rename from Web_Scraper.py rename to web_scraper_1.py diff --git a/Web Socket.py b/web_socket.py similarity index 100% rename from Web Socket.py rename to web_socket.py diff --git a/Webbrowser/tk-browser.py b/webbrowser_1/tk-browser.py similarity index 100% rename from Webbrowser/tk-browser.py rename to webbrowser_1/tk-browser.py diff --git a/wifi hack by brutefore.py b/wifi_hack_by_brutefore.py similarity index 100% rename from wifi hack by brutefore.py rename to wifi_hack_by_brutefore.py diff --git a/WikipediaModule.py b/wikipediamodule_1.py similarity index 100% rename from WikipediaModule.py rename to wikipediamodule_1.py diff --git a/Windows_Wallpaper_Script/ReadMe.md b/windows_wallpaper_script_1/ReadMe.md similarity index 100% rename from Windows_Wallpaper_Script/ReadMe.md rename to windows_wallpaper_script_1/ReadMe.md diff --git a/Windows_Wallpaper_Script/Wallpapers/desktop/89d49683c75888287b50ccb05cab960b991231639dabe5bc817e1d9395a39694.jpg b/windows_wallpaper_script_1/Wallpapers/desktop/89d49683c75888287b50ccb05cab960b991231639dabe5bc817e1d9395a39694.jpg similarity index 100% rename from Windows_Wallpaper_Script/Wallpapers/desktop/89d49683c75888287b50ccb05cab960b991231639dabe5bc817e1d9395a39694.jpg rename to windows_wallpaper_script_1/Wallpapers/desktop/89d49683c75888287b50ccb05cab960b991231639dabe5bc817e1d9395a39694.jpg diff --git a/Windows_Wallpaper_Script/Wallpapers/desktop/acc15612b1c85619e06c584a52f6474242963dbb9fe315ec4ecd44de8f3702c8.jpg b/windows_wallpaper_script_1/Wallpapers/desktop/acc15612b1c85619e06c584a52f6474242963dbb9fe315ec4ecd44de8f3702c8.jpg similarity index 100% rename from Windows_Wallpaper_Script/Wallpapers/desktop/acc15612b1c85619e06c584a52f6474242963dbb9fe315ec4ecd44de8f3702c8.jpg rename to windows_wallpaper_script_1/Wallpapers/desktop/acc15612b1c85619e06c584a52f6474242963dbb9fe315ec4ecd44de8f3702c8.jpg diff --git a/Windows_Wallpaper_Script/Wallpapers/desktop/c1385a4022859c16bdf317e09668dbb3fc41a7e1c160605539abd1bcd29625af.jpg b/windows_wallpaper_script_1/Wallpapers/desktop/c1385a4022859c16bdf317e09668dbb3fc41a7e1c160605539abd1bcd29625af.jpg similarity index 100% rename from Windows_Wallpaper_Script/Wallpapers/desktop/c1385a4022859c16bdf317e09668dbb3fc41a7e1c160605539abd1bcd29625af.jpg rename to windows_wallpaper_script_1/Wallpapers/desktop/c1385a4022859c16bdf317e09668dbb3fc41a7e1c160605539abd1bcd29625af.jpg diff --git a/Windows_Wallpaper_Script/Wallpapers/mobile/5678c6685841ab637cfa63b8c0e32ee205649af2051eb75f40b00f4d5a42b7b9.jpg b/windows_wallpaper_script_1/Wallpapers/mobile/5678c6685841ab637cfa63b8c0e32ee205649af2051eb75f40b00f4d5a42b7b9.jpg similarity index 100% rename from Windows_Wallpaper_Script/Wallpapers/mobile/5678c6685841ab637cfa63b8c0e32ee205649af2051eb75f40b00f4d5a42b7b9.jpg rename to windows_wallpaper_script_1/Wallpapers/mobile/5678c6685841ab637cfa63b8c0e32ee205649af2051eb75f40b00f4d5a42b7b9.jpg diff --git a/Windows_Wallpaper_Script/Wallpapers/mobile/a33845e422c7d1b668f60e53e942736c7bbc74299469b7df734254d28e026dc4.jpg b/windows_wallpaper_script_1/Wallpapers/mobile/a33845e422c7d1b668f60e53e942736c7bbc74299469b7df734254d28e026dc4.jpg similarity index 100% rename from Windows_Wallpaper_Script/Wallpapers/mobile/a33845e422c7d1b668f60e53e942736c7bbc74299469b7df734254d28e026dc4.jpg rename to windows_wallpaper_script_1/Wallpapers/mobile/a33845e422c7d1b668f60e53e942736c7bbc74299469b7df734254d28e026dc4.jpg diff --git a/Windows_Wallpaper_Script/Wallpapers/mobile/e22f23869f500ee576cdc02fb83f911de31440d589e329d04576e571a54b8851.jpg b/windows_wallpaper_script_1/Wallpapers/mobile/e22f23869f500ee576cdc02fb83f911de31440d589e329d04576e571a54b8851.jpg similarity index 100% rename from Windows_Wallpaper_Script/Wallpapers/mobile/e22f23869f500ee576cdc02fb83f911de31440d589e329d04576e571a54b8851.jpg rename to windows_wallpaper_script_1/Wallpapers/mobile/e22f23869f500ee576cdc02fb83f911de31440d589e329d04576e571a54b8851.jpg diff --git a/Windows_Wallpaper_Script/wallpaper_extract.py b/windows_wallpaper_script_1/wallpaper_extract.py similarity index 100% rename from Windows_Wallpaper_Script/wallpaper_extract.py rename to windows_wallpaper_script_1/wallpaper_extract.py diff --git a/Wordle/5 letter word dictionary.txt b/wordle_1/5 letter word dictionary.txt similarity index 100% rename from Wordle/5 letter word dictionary.txt rename to wordle_1/5 letter word dictionary.txt diff --git a/Wordle/Dictionary.txt b/wordle_1/Dictionary.txt similarity index 100% rename from Wordle/Dictionary.txt rename to wordle_1/Dictionary.txt diff --git a/Wordle/wordle.py b/wordle_1/wordle.py similarity index 100% rename from Wordle/wordle.py rename to wordle_1/wordle.py diff --git a/XML/HTML parsing b/xml_1/HTML parsing similarity index 100% rename from XML/HTML parsing rename to xml_1/HTML parsing diff --git a/XORcipher/README.md b/xorcipher_1/README.md similarity index 100% rename from XORcipher/README.md rename to xorcipher_1/README.md diff --git a/XORcipher/XOR_cipher.py b/xorcipher_1/XOR_cipher.py similarity index 100% rename from XORcipher/XOR_cipher.py rename to xorcipher_1/XOR_cipher.py diff --git a/XORcipher/test_XOR_cipher.py b/xorcipher_1/test_XOR_cipher.py similarity index 100% rename from XORcipher/test_XOR_cipher.py rename to xorcipher_1/test_XOR_cipher.py diff --git a/Youtube Downloader With GUI/Screenshot (138).png b/youtube_downloader_with_gui/Screenshot (138).png similarity index 100% rename from Youtube Downloader With GUI/Screenshot (138).png rename to youtube_downloader_with_gui/Screenshot (138).png diff --git a/Youtube Downloader With GUI/main.py b/youtube_downloader_with_gui/main.py similarity index 100% rename from Youtube Downloader With GUI/main.py rename to youtube_downloader_with_gui/main.py diff --git a/Youtube Downloader With GUI/photo.jpg b/youtube_downloader_with_gui/photo.jpg similarity index 100% rename from Youtube Downloader With GUI/photo.jpg rename to youtube_downloader_with_gui/photo.jpg diff --git a/Youtube Downloader With GUI/photo.png b/youtube_downloader_with_gui/photo.png similarity index 100% rename from Youtube Downloader With GUI/photo.png rename to youtube_downloader_with_gui/photo.png diff --git a/Youtube Downloader With GUI/youtube-ios-app.ico b/youtube_downloader_with_gui/youtube-ios-app.ico similarity index 100% rename from Youtube Downloader With GUI/youtube-ios-app.ico rename to youtube_downloader_with_gui/youtube-ios-app.ico From f53b82379f001fe75de8dda83915140394b3c2f3 Mon Sep 17 00:00:00 2001 From: Nitkarsh Chourasia Date: Sun, 23 Jul 2023 05:39:29 +0530 Subject: [PATCH 3/4] snake case renaming of the sorting algorithm folder, as they are standalone programs and not a small project. --- snake_case_renamer_depth_one.py | 2 +- .../{Binary_Insertion_Sort.py => binary_insertion_sort_1.py} | 0 sorting_algorithms/{brickSort.py => bricksort_1.py} | 0 sorting_algorithms/{Bubble_sort.py => bubble_sort_1.py} | 0 .../{Bubble_Sorting_Prog.py => bubble_sorting_prog_1.py} | 0 sorting_algorithms/{Count sort.py => count_sort.py} | 0 sorting_algorithms/{Counting-sort.py => counting-sort_1.py} | 0 sorting_algorithms/{Counting Sort.py => counting_sort.py} | 0 sorting_algorithms/{Cycle Sort.py => cycle_sort.py} | 0 sorting_algorithms/desktop.ini | 4 ++++ sorting_algorithms/{Heap sort.py => heap_sort_1.py} | 0 .../{Iterative Merge Sort.py => iterative_merge_sort.py} | 0 .../{Linear_Insertion_Sort.py => linear_insertion_sort_1.py} | 0 sorting_algorithms/{Merge-sort.py => merge-sort_1.py} | 0 sorting_algorithms/{Merge Sort.py => merge_sort_1.py} | 0 sorting_algorithms/{Quick sort.py => quick_sort_1.py} | 0 sorting_algorithms/{selectionSort.py => selectionsort_1.py} | 0 sorting_algorithms/{Shell Sort.py => shell_sort.py} | 0 ....py => sort_the_values_of_first_list_using_second_list.py} | 0 ...serted_Linked_List.py => sorted_inserted_linked_list_1.py} | 0 sorting_algorithms/{Sorting_List.py => sorting_list_1.py} | 0 ...ingAlphabetically.py => sortingastringalphabetically_1.py} | 0 sorting_algorithms/{Tim_sort.py => tim_sort_1.py} | 0 23 files changed, 5 insertions(+), 1 deletion(-) rename sorting_algorithms/{Binary_Insertion_Sort.py => binary_insertion_sort_1.py} (100%) rename sorting_algorithms/{brickSort.py => bricksort_1.py} (100%) rename sorting_algorithms/{Bubble_sort.py => bubble_sort_1.py} (100%) rename sorting_algorithms/{Bubble_Sorting_Prog.py => bubble_sorting_prog_1.py} (100%) rename sorting_algorithms/{Count sort.py => count_sort.py} (100%) rename sorting_algorithms/{Counting-sort.py => counting-sort_1.py} (100%) rename sorting_algorithms/{Counting Sort.py => counting_sort.py} (100%) rename sorting_algorithms/{Cycle Sort.py => cycle_sort.py} (100%) create mode 100644 sorting_algorithms/desktop.ini rename sorting_algorithms/{Heap sort.py => heap_sort_1.py} (100%) rename sorting_algorithms/{Iterative Merge Sort.py => iterative_merge_sort.py} (100%) rename sorting_algorithms/{Linear_Insertion_Sort.py => linear_insertion_sort_1.py} (100%) rename sorting_algorithms/{Merge-sort.py => merge-sort_1.py} (100%) rename sorting_algorithms/{Merge Sort.py => merge_sort_1.py} (100%) rename sorting_algorithms/{Quick sort.py => quick_sort_1.py} (100%) rename sorting_algorithms/{selectionSort.py => selectionsort_1.py} (100%) rename sorting_algorithms/{Shell Sort.py => shell_sort.py} (100%) rename sorting_algorithms/{Sort the values of first list using second list.py => sort_the_values_of_first_list_using_second_list.py} (100%) rename sorting_algorithms/{Sorted_Inserted_Linked_List.py => sorted_inserted_linked_list_1.py} (100%) rename sorting_algorithms/{Sorting_List.py => sorting_list_1.py} (100%) rename sorting_algorithms/{SortingAStringAlphabetically.py => sortingastringalphabetically_1.py} (100%) rename sorting_algorithms/{Tim_sort.py => tim_sort_1.py} (100%) diff --git a/snake_case_renamer_depth_one.py b/snake_case_renamer_depth_one.py index 089e75ff2dd..7f47f74d325 100644 --- a/snake_case_renamer_depth_one.py +++ b/snake_case_renamer_depth_one.py @@ -1,6 +1,6 @@ import os -repository_path = r"D:\coding\Python-Programs" +repository_path = r"D:\coding\Python-Programs\sorting_algorithms" def rename_files_and_folders(directory): for name in os.listdir(directory): diff --git a/sorting_algorithms/Binary_Insertion_Sort.py b/sorting_algorithms/binary_insertion_sort_1.py similarity index 100% rename from sorting_algorithms/Binary_Insertion_Sort.py rename to sorting_algorithms/binary_insertion_sort_1.py diff --git a/sorting_algorithms/brickSort.py b/sorting_algorithms/bricksort_1.py similarity index 100% rename from sorting_algorithms/brickSort.py rename to sorting_algorithms/bricksort_1.py diff --git a/sorting_algorithms/Bubble_sort.py b/sorting_algorithms/bubble_sort_1.py similarity index 100% rename from sorting_algorithms/Bubble_sort.py rename to sorting_algorithms/bubble_sort_1.py diff --git a/sorting_algorithms/Bubble_Sorting_Prog.py b/sorting_algorithms/bubble_sorting_prog_1.py similarity index 100% rename from sorting_algorithms/Bubble_Sorting_Prog.py rename to sorting_algorithms/bubble_sorting_prog_1.py diff --git a/sorting_algorithms/Count sort.py b/sorting_algorithms/count_sort.py similarity index 100% rename from sorting_algorithms/Count sort.py rename to sorting_algorithms/count_sort.py diff --git a/sorting_algorithms/Counting-sort.py b/sorting_algorithms/counting-sort_1.py similarity index 100% rename from sorting_algorithms/Counting-sort.py rename to sorting_algorithms/counting-sort_1.py diff --git a/sorting_algorithms/Counting Sort.py b/sorting_algorithms/counting_sort.py similarity index 100% rename from sorting_algorithms/Counting Sort.py rename to sorting_algorithms/counting_sort.py diff --git a/sorting_algorithms/Cycle Sort.py b/sorting_algorithms/cycle_sort.py similarity index 100% rename from sorting_algorithms/Cycle Sort.py rename to sorting_algorithms/cycle_sort.py diff --git a/sorting_algorithms/desktop.ini b/sorting_algorithms/desktop.ini new file mode 100644 index 00000000000..d957fd188db --- /dev/null +++ b/sorting_algorithms/desktop.ini @@ -0,0 +1,4 @@ +[ViewState] +Mode= +Vid= +FolderType=Generic diff --git a/sorting_algorithms/Heap sort.py b/sorting_algorithms/heap_sort_1.py similarity index 100% rename from sorting_algorithms/Heap sort.py rename to sorting_algorithms/heap_sort_1.py diff --git a/sorting_algorithms/Iterative Merge Sort.py b/sorting_algorithms/iterative_merge_sort.py similarity index 100% rename from sorting_algorithms/Iterative Merge Sort.py rename to sorting_algorithms/iterative_merge_sort.py diff --git a/sorting_algorithms/Linear_Insertion_Sort.py b/sorting_algorithms/linear_insertion_sort_1.py similarity index 100% rename from sorting_algorithms/Linear_Insertion_Sort.py rename to sorting_algorithms/linear_insertion_sort_1.py diff --git a/sorting_algorithms/Merge-sort.py b/sorting_algorithms/merge-sort_1.py similarity index 100% rename from sorting_algorithms/Merge-sort.py rename to sorting_algorithms/merge-sort_1.py diff --git a/sorting_algorithms/Merge Sort.py b/sorting_algorithms/merge_sort_1.py similarity index 100% rename from sorting_algorithms/Merge Sort.py rename to sorting_algorithms/merge_sort_1.py diff --git a/sorting_algorithms/Quick sort.py b/sorting_algorithms/quick_sort_1.py similarity index 100% rename from sorting_algorithms/Quick sort.py rename to sorting_algorithms/quick_sort_1.py diff --git a/sorting_algorithms/selectionSort.py b/sorting_algorithms/selectionsort_1.py similarity index 100% rename from sorting_algorithms/selectionSort.py rename to sorting_algorithms/selectionsort_1.py diff --git a/sorting_algorithms/Shell Sort.py b/sorting_algorithms/shell_sort.py similarity index 100% rename from sorting_algorithms/Shell Sort.py rename to sorting_algorithms/shell_sort.py diff --git a/sorting_algorithms/Sort the values of first list using second list.py b/sorting_algorithms/sort_the_values_of_first_list_using_second_list.py similarity index 100% rename from sorting_algorithms/Sort the values of first list using second list.py rename to sorting_algorithms/sort_the_values_of_first_list_using_second_list.py diff --git a/sorting_algorithms/Sorted_Inserted_Linked_List.py b/sorting_algorithms/sorted_inserted_linked_list_1.py similarity index 100% rename from sorting_algorithms/Sorted_Inserted_Linked_List.py rename to sorting_algorithms/sorted_inserted_linked_list_1.py diff --git a/sorting_algorithms/Sorting_List.py b/sorting_algorithms/sorting_list_1.py similarity index 100% rename from sorting_algorithms/Sorting_List.py rename to sorting_algorithms/sorting_list_1.py diff --git a/sorting_algorithms/SortingAStringAlphabetically.py b/sorting_algorithms/sortingastringalphabetically_1.py similarity index 100% rename from sorting_algorithms/SortingAStringAlphabetically.py rename to sorting_algorithms/sortingastringalphabetically_1.py diff --git a/sorting_algorithms/Tim_sort.py b/sorting_algorithms/tim_sort_1.py similarity index 100% rename from sorting_algorithms/Tim_sort.py rename to sorting_algorithms/tim_sort_1.py From 4b58307cf7f57426506d5e4ce099d6ff9f114681 Mon Sep 17 00:00:00 2001 From: Nitkarsh Chourasia Date: Thu, 27 Jul 2023 08:11:38 +0530 Subject: [PATCH 4/4] Update snake_case_renamer_depth_one.py Making it more adhered to the best practices and standards of python programming language. --- snake_case_renamer_depth_one.py | 74 +++++++++++++++++++++++++++++---- 1 file changed, 65 insertions(+), 9 deletions(-) diff --git a/snake_case_renamer_depth_one.py b/snake_case_renamer_depth_one.py index 7f47f74d325..fdedcb54a7f 100644 --- a/snake_case_renamer_depth_one.py +++ b/snake_case_renamer_depth_one.py @@ -1,8 +1,45 @@ import os +import argparse +from typing import Union -repository_path = r"D:\coding\Python-Programs\sorting_algorithms" +def generate_unique_name(directory: str, name: str) -> str: + """ + Generate a unique name for a file or folder in the specified directory. + + Parameters: + ---------- + directory : str + The path to the directory. + name : str + The name of the file or folder. + + Returns: + ------- + str + The unique name with an index. + """ + base_name, extension = os.path.splitext(name) + index = 1 + while os.path.exists(os.path.join(directory, f"{base_name}_{index}{extension}")): + index += 1 + return f"{base_name}_{index}{extension}" + +def rename_files_and_folders(directory: str) -> None: + """ + Rename files and folders in the specified directory to lowercase with underscores. + + Parameters: + ---------- + directory : str + The path to the directory containing the files and folders to be renamed. + + Returns: + ------- + None + """ + if not os.path.isdir(directory): + raise ValueError("Invalid directory path.") -def rename_files_and_folders(directory): for name in os.listdir(directory): old_path = os.path.join(directory, name) new_name = name.lower().replace(" ", "_") @@ -12,12 +49,31 @@ def rename_files_and_folders(directory): if new_name != name: # Check if the new filename already exists in the directory if os.path.exists(new_path): - # If the new filename exists, add a number at the end to make it unique - index = 1 - while os.path.exists(f"{os.path.splitext(new_path)[0]}_{index}{os.path.splitext(new_path)[1]}"): - index += 1 - new_path = f"{os.path.splitext(new_path)[0]}_{index}{os.path.splitext(new_path)[1]}" - + # If the new filename exists, generate a unique name with an index + new_path = generate_unique_name(directory, new_name) + os.rename(old_path, new_path) -rename_files_and_folders(repository_path) +def main() -> None: + """ + Main function to handle command-line arguments and call the renaming function. + + Usage: + ------ + python script_name.py + + Example: + -------- + python rename_files_script.py /path/to/directory + + """ + # Create a parser for command-line arguments + parser = argparse.ArgumentParser(description="Rename files and folders to lowercase with underscores.") + parser.add_argument("directory", type=str, help="Path to the directory containing the files and folders to be renamed.") + args = parser.parse_args() + + # Call the rename_files_and_folders function with the provided directory path + rename_files_and_folders(args.directory) + +if __name__ == "__main__": + main()