-
-
Notifications
You must be signed in to change notification settings - Fork 46k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Monte Carlo dice simulation algorithm #1759
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cclauss
reviewed
Feb 17, 2020
onlinejudge95
requested changes
Feb 17, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good
cclauss
approved these changes
Feb 17, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!!
onlinejudge95
approved these changes
Feb 17, 2020
BurhanH
added a commit
to BurhanH/Python
that referenced
this pull request
May 18, 2020
* Improve doctest and comment for maximum sub-array problem (#1503) * Doctest and comment for maximum sub-array problem More examples and description for max_sub_array.py * Update max_sub_array.py * Update max_sub_array.py * Fix doctest * Page replacement algorithm, LRU (#871) * Page replacement algorithm, LRU * small rectifications * Rename paging/LRU.py to other/least_recently_used.py * Addition of Secant Method (#876) * Add files via upload * Update secant_method.py * Remove unused import * Remove unused import * Create GAN.py (#1445) * Create GAN.py * gan update * Delete train-labels-idx1-ubyte.gz * Update GAN.py * Update GAN.py * Delete GAN.py * Create gan.py * Update gan.py * input_data import file * Update dictionary.txt (#1507) Added a new word Microfinance. This is one of the recently added word in oxford dictionary * Update greatest_common_divisor.py (#1513) Add Doctests. * Update palindrome.py (#1509) * Update palindrome.py Add Doctests. * Use test_data to drive the testing * :white_check_mark: added tests for Perceptron in Neural Networks (#1506) * :white_check_mark: added tests for Perceptron in Neural Networks * Space * Format code with psf/black * Add doctests to other/word_patterns.py (#1518) * Create prime_numbers.py (#1519) * Create prime_numbers.py * Update prime_numbers.py * Update basic_maths.py (#1517) * Update basic_maths.py Add Doctests. * Update basic_maths.py * Add a space to fix the doctest * Factors of a number (#1493) * Factors of a number * Update factors.py * Fix mypy issue in basic_maths.py * Fix mypy error in perceptron.py * def primes(max: int) -> List[int]: * Update binomial_heap.py * Add a space * Remove a space * Add a space * average_mode.py (#1491) * Add files via upload Finds the mode in the input data. * Update average_mode.py * Update average_mode.py * Update average_mode.py * Update average_mode.py * Update average_mode.py * Update average_mode.py * Tabs do not belong in Python files! * Simplified DES (#1382) * Simplified DES * Add files via upload Diffie Hellman algorithm to generate a secret key. * Update sdes.py * Format code with psf/black and add doctests * Update quick_select.py (#1523) * Update quick_select.py Add Doctests. * Add typehints * Don't pre-allocate "smaller" and "larger" * Doctest, type hints and bug in LIS_O(nlogn) (#1525) * Update longest_increasing_subsequence_o(nlogn).py * Update longest_increasing_subsequence_o(nlogn).py * Euler Problem 27 solution script Added (#1466) * Add files via upload * Update DIRECTORY.md * Create sol1.py * Update sol1.py * Create __init__.py * Update DIRECTORY.md * Delete isotonic.py * Update sol1.py * Problem_27_project_euler * project_euler/Problem_27/sol1.py * project_euler/Problem_27/sol1.py * project_euler/problem_27/ * project_euler/problem_27 * project_euler/problem_27 * update sol1 of Euler Problem 27 solution script Added * Remove slow test, wrap long comments, format with psf/black * Delete __init__.py * Add type hints * Add doctests to function is_prime() * Rename project_euler/problem_27/project_euler/problem_27/sol1.pysol1.py to project_euler/problem_27/problem_27_sol1.py * perfect square (#1534) * perfect square * perfect square * Added Problem 33 (#1440) * Create sol1.py * Create __init__.py * Update sol1.py * corrected range * Update sol1.py * update factorial (#1535) * update factorial * update factorial * add max sum contigous subsequence (#1537) * add max sum contigous subsequence * fix typo * Add doctest and type hints * Create autoblack.yml * recursive quick sort (#1536) * recursive quick sort * recursive quick sort * Delete recursive-quick-sort * Update recursive-quick-sort.py * Non-recursive Segment Tree implementation (#1543) * Non-recursive Segment Tree implementation * Added type hints and explanations links * Travis CI: Write & print DIRECTORY.md on one line (#1542) * travis test * travis pull ID test * get pr branch test * retry pr build * test pushing back - probable git error for origin 'not found' * github auth? * add .sh * chmod * add index update for permission fix * run sh for script * add all * add pull directory * fetch pr branch * swap placement of adding commits * rotate * quit trying to update Travis * formatting leftovers * Travis CI: Write & print DIRECTORY.md on one line * added solution 1 for problem_99 in project_euler (#1545) * Create sol1.py * Create __init__.py * Update sol1.py * corrected range * Add files via upload * Update DIRECTORY.md * Create sol1.py * Update sol1.py * Create __init__.py * Update DIRECTORY.md * Delete isotonic.py * Update sol1.py * Problem_27_project_euler * project_euler/Problem_27/sol1.py * project_euler/Problem_27/sol1.py * project_euler/problem_27/ * project_euler/problem_27 * project_euler/problem_27 * update sol1 of Euler Problem 27 solution script Added * Remove slow test, wrap long comments, format with psf/black * Delete __init__.py * Add type hints * Add doctests to function is_prime() * Rename project_euler/problem_27/project_euler/problem_27/sol1.pysol1.py to project_euler/problem_27/problem_27_sol1.py * Added Problem 33 * added solution 1 for problem_99 * update added solution 1 for problem_99 * update * Update sol1.py * add floor() (#1551) * ceil and floor * ceil and floor * Porta cipher (#1550) * directory_writer * add porta cipher for #1492 * formatting and one line comprehensions * remove directory_writer * indentions * Wrap long lines * Doctest and typing for longest_increasing_subsequence.py (#1526) * Update longest_increasing_subsequence.py * Update longest_increasing_subsequence.py * Format longest_increasing_subsequence.py to PEP8 * Update longest_increasing_subsequence.py * Add sol3 for project_euler problem_03 (#1553) * Add sol3 for project_euler proble_03 * Update sol3.py add type hint remove unused variable * Format code with psf/black * added rsa_factorization.py (#1556) * added RSA_factorization.py This algorithm can effectively factor RSA large prime N given public key e and private key d. * Rename RSA_factorization.py to rsa_factorization.py * Add definitions for d, e, and N * Improved on Singly Linked List Programs (#1558) * Improved Singly Linked List Added String Representations of Nodes and Linked Lists Added support for indexing and changing of Node data using indices. * Added a few comments to Linked Lists * Reformatted to conform to PEP8 * Added from_sequence.py Convert a Python List to Linked List comprising of Nodes and return head. * Added print_reverse.py Recursive program to print the elements of a Linked List in reverse. * Change 'is not None' for more Pythonicness * Fix bug in bellman_ford.py (#1544) * Python Program that fetches top trending news (#1559) * Python Program that fetches top trending news * Python Program that fetches top trending news * Revisions in Fetch BBC News * Added a new Python script and some changes in existing one (#1560) * Python Program that fetches top trending news * Python Program that fetches top trending news * Revisions in Fetch BBC News * psf/black Changes * Python Program to send slack message to a channel * Slack Message Revision Changes * Moved to TheAlgorithms/Jupyter (#1563) https://github.com/TheAlgorithms/Jupyter/tree/master/other * Panagram Script Added (#1564) * Python Program that fetches top trending news * Python Program that fetches top trending news * Revisions in Fetch BBC News * psf/black Changes * Python Program to send slack message to a channel * Slack Message Revision Changes * Python Program to check Palindrome String * Doctest Added * Python Program to check whether a String is Panagram or not * Python Program to check whether a String is Panagram or not * Check Panagram Script Added * Panagram Script Added * Anagram Script Changes * Anagram Alphabet Check Added * Python Program to fetch github info * add sol3 to project_euler/problem_08 (#1557) * Add sol3 for project_euler proble_03 * Update sol3.py add type hint remove unused variable * Format code with psf/black * add sol3 to project_euler/problem_08, modify the stepsize of the loop,will be faster than sol1 * GitHub Action formats our code with psf/black (#1569) * GitHub Action formats our code with psf/black @poyea Your review please. * fixup! Format Python code with psf/black push * directory_writer (#1) (#1549) * directory_writer * fixup: Format Python code with psf/black * fixup: DIRECTORY.md * fix implementation errors. (#1568) I revised my implementation and found out that I have miss a inner loop for t. x and y should be recalculated everytime when t is divisble by 2. I have also included a more readble source for this algorithm. * Remove Duplicate Script Added (#1570) * Added Remove duplicate script and updated requirements.txt * Requirements.txt Updated * Remove Duplicate Script Added * Directory Modified * Directory.md Updated * changed implementation of GitHub action to auto update DIRECTORY.md (#1571) * changed implementation of GitHub action to auto update DIRECTORY.md * updating DIRECTORY.md * || true (#1572) * || true * 3.8 * python: 3.x * Fix indentation contains tabs (flake8 E101,W191) (#1573) * Word Occurence Script Added (#1576) * Word Occurence Script Added * Word Occurence Script Updated * Added doctest using collections.Counter https://docs.python.org/3/library/collections.html#collections.Counter * Add pytest-cov (#1578) * Add pytest-cov Also added coverage report in .travis.yml file. * updating DIRECTORY.md * Sort by missing statements * sort = Cover * Remove code with side effects from main (#1577) * Remove code with side effects from main When running tests withy pytest, some modules execute code in main scope and open plot or browser windows. Moves such code under `if __name__ == "__main__"`. * fixup! Format Python code with psf/black push * Adding circular_queue.py (#1574) * Create circular_queue.py Circular Queue implementation using python list with fixed range. * Update circular_queue.py * Update circular_queue.py * Update circular_queue.py * Update circular_queue.py * Update circular_queue.py * doctest: Catch "Exception: UNDERFLOW" * Deal with the fluent interface for cq.enqueue() * Test the fluent interface * Reverse Words (#1581) * Word Occurence Script Added * Word Occurence Script Updated * Added doctest using collections.Counter https://docs.python.org/3/library/collections.html#collections.Counter * Reverse Word Script Added * Reverse Word Script Added * Reverse Word Script Added * Reverse Word Script Added * Word Occurence Script Added * Reverse Word Script Added * Reverse Word Script Added * Reverse Words DocTest Updated * Word Occurence Updated * Doctest Updated * Doctest Updated * Doctest Updated * Adds operations for circular linked list (#1584) * Adds, append, len, print operations for circular linked list * Adds, prepend support * Adds, delete from front of the list * Adds, delete_rear support * Adds, method documentations * Adds, type checking and doctests * Updates doctest for delete ops * Addressing requested changes * Removes unused import * Fixes failing doctests * Minor modifications... * Improve bellman_ford.py (#1575) * Fix out of range error in bellman_ford.py * Update bellman_ford.py * fixup! Format Python code with psf/black push * Enhance the print function * fixup! Format Python code with psf/black push * Update gaussian_filter.py (#1548) * Update gaussian_filter.py Changed embedded for loops with product. This way range(dst_height) is called only once, instead of being called $dst_height. * Update gaussian_filter.py fixed missing width * Tabs --> spaces in quine_mc_cluskey.py (#1426) * Tabs --> spaces in quine_mc_cluskey.py * fixup! Format Python code with psf/black push * Fractional knapsack (#1524) * Add files via upload * Added doctests, type hints, f-strings, URLs * Rename knapsack.py to fractional_knapsack.py * Rename graphs/fractional_knapsack.py to dynamic_programming/fractional_knapsack_2.py * Update README.md (#1588) * Update README.md * python -m unittest -v * added current stock price (#1590) * added current stock price * Ten lines or less * Implemented simple keyword cipher (#1589) * Implemented simple keyword cipher * Added documentation and improved input processing * Allow object's hash function to be called * added to string functionality * reverted * Revised according to pull request #1589 * Optimized imports * Update simple_keyword_cypher.py * Update hash_table.py * Update singly_linked_list.py (#1593) * Update singly_linked_list.py printing current.data rather than node address in __repr__ for a more readable print statement * eval(repr(c)) == c The output of `__repr__()` _should look like a valid Python expression that could be used to recreate an object with the same value_. https://docs.python.org/3.4/reference/datamodel.html#object.__repr__ * += --> + * Adding Linear Discriminant Analysis (#1592) * Adding new file to the machine_learning directory * Adding initial documentation * importing modules * Adding Normal_gen function * Adding Y_gen function * Adding mean_calc function * Adding prob_calc function * Adding var_calc function * Adding predict function * Adding accuracy function * Adding main function * Renaming LDA file * Adding requested changes * Renaming some of functions * Refactoring str.format() statements to f-string * Removing unnecessary list objects inside two functions * changing code style in some lines * Fixing y_generator function * Refactoring 'predict_y_values' function by using list comprehensions * Changing code style in import statements * Refactoring CLI code block * fixup! Format Python code with psf/black push * No lines longer than 88 characters * GitHub Action to mark stale issues and pull requests (#1594) * converting generator object to a list object (#1602) * converting generator object to a list object * Refactor: converting generator object to a list object * fixup! Format Python code with psf/black push * Typo in a comment (#1603) * add a generic heap (#906) * add a generic heap * Delete __init__.py * Rename data_structures/Heap/heap_generic.py to data_structures/heap/heap_generic.py * Add doctests * Fix doctests * Fix doctests again * Improve prim.py (#1226) * suiting PEP8 * create auxiliary function * running example * updating DIRECTORY.md * Pythagoras (#1243) * add pythagoras.py * function distance * run as script * Update pythagoras.py * Code for Eulers Totient function (#1229) * Create eulersTotient.py * Rename eulersTotient.py to eulers_totient.py * Update eulers_totient.py * fixed bug (#1610) Removed comma from print statement causing and error. * Added Multilayer Perceptron (sklearn) (#1609) * Added Multilayer Perceptron ( sklearn) * Rename MLPClassifier.py to multilayer_preceptron_classifier.py * Rename multilayer_preceptron_classifier.py to multilayer_perceptron_classifier.py * Update multilayer_perceptron_classifier.py * address merge_soft duplicate files (#1612) Here the old file merge_sort_fastest is renamed to unknown_sort. Because it is not merge sort algorithm. Comments are updated accordingly. * add the index calculation class at digital_image_processing and the hamming code algorithm at hashes (#1152) * add the index calculation at difital_image_processing file * make changes at index_calculation * update the variables to self variables at functions * update the word wrap in comments at index_calculation * add the hamming code algorithm * Wrap long lines * pigeonhole sorting in python (#364) * pigeonhole sorting in python * variable name update in pigeonhole_sort.py * Add doctest * improved prime numbers implementation (#1606) * improved prime numbers implementation * fixup! Format Python code with psf/black push * fix type hint * fixup! Format Python code with psf/black push * fix doctests * updating DIRECTORY.md * added prime tests with negative numbers * using for instead filter * updating DIRECTORY.md * Remove unused typing.List * Remove tab indentation * print("Sorted order is:", " ".join(a)) * Improved readability (#1615) * improved readability * further readability improvements * removed csv file and added f * Simplify sudoku.is_completed() using builtin all() (#1608) * Simplify sudoku.is_completed() using builtin all() Simplify __sudoku.is_completed()__ using Python builtin function [__all()__](https://docs.python.org/3/library/functions.html#all). * fixup! Format Python code with psf/black push * Update sudoku.py * fixup! Format Python code with psf/black push * Old style exception -> new style for Python 3 * updating DIRECTORY.md * Update convex_hull.py * fixup! Format Python code with psf/black push * e.args[0] = "msg" * ValueError: could not convert string to float: 'pi' * Update convex_hull.py * fixup! Format Python code with psf/black push * Adding doctests into LDA algorithm (#1621) * Adding doctests into <gaussian_distribution> function * Adding doctests into <y_generator> function * Adding doctests into <calculate_mean> function * Adding doctests into <calculate_probabilities> function * Adding doctests into <calculate_variance> function * Adding doctests into <predict_y_values> function * Adding doctests into <accuracy> function * fixup! Format Python code with psf/black push * Update convex_hull.py * Update convex_hull.py * Fixed issue #1368 (#1482) * Changed as suggested Now return in same format as oct() returns * Slight change * Fixed issue #1368, return values for large number now is fixed and does not return in scientific notation * Update decimal_to_octal.py * Update odd_even_transposition_parallel.py (#1458) * Update odd_even_transposition_parallel.py * arr = OddEvenTransposition(arr) * digital_image_processing/convert_to_negative (#1216) * digital_image_processing/convert_to_negative * added doc * added test code * Update convert_to_negative.py * Image processing algorithms added (#616) * Image processing algorithms added * Example images included * Issues resolved * class added * Naming issues fixes * Create file_path * Remove \r from strings (#1622) * Remove \r from strings * Satisfy tensorflow with numpy>=1.17.4 * Update find_min.py (#1627) Line 5: :return: max number in list "max" must be "min" * Harmonic Geometric and P-Series Added (#1633) * Harmonic Geometric and P-Series Added * Editing comments * Update and rename series/Geometric_Series.py to maths/series/geometric_series.py * Update and rename series/Harmonic_Series.py to maths/series/harmonic_series.py * Update and rename series/P_Series.py to maths/series/p_series.py * Bug Fixed in newton_raphson_method.py (#1634) * Bug Fixed * Fixed newton_raphson_method.py * Fixed newton_raphson_method.py 2 * Fixed newton_raphson_method.py 3 * Fixed newton_raphson_method.py 4 * Fixed newton_raphson_method.py 5 * Fixed newton_raphson_method.py 6 * Update newton_raphson_method.py * Update newton_raphson_method.py * # noqa: F401, F403 * newton_raphson * newton_raphson * precision: int=10 ** -10 * return float(x) * 3.1415926536808043 * Update newton_raphson_method.py * 2.23606797749979 * Update newton_raphson_method.py * Rename newton_raphson_method.py to newton_raphson.py * adding doctests on coin_change.py and fixed some typos (#1337) * adding doctests on coin_change.py * fixed some typos * Update lib.py * file iterating_through_submasks.py for given mask is added in dynamic_programming (#1635) * new file *iterating_through_submasks* is added in dynamic_programming section * no changes * *iterating_through_submasks.py is added in dynamic_programming * iterating_through_submasks is added with doctests * iterating_through_submasks.py is added in dynamic_programming * changes made in *iterating_through_submasks.py * changes made in *iterating_through_submasks.py * updated * Add docstr and algorithm to BFS shortest path module (#1637) * Add docs and type alias to bfs_shortest_path.py * Add bfs_shortest_path_distance algorithm * Make requested changes * other/integeration_by_simpson_approx.py is added for approximate integeration (#1638) * new file *iterating_through_submasks* is added in dynamic_programming section * no changes * *iterating_through_submasks.py is added in dynamic_programming * iterating_through_submasks is added with doctests * iterating_through_submasks.py is added in dynamic_programming * changes made in *iterating_through_submasks.py * changes made in *iterating_through_submasks.py * updated * *other/integeration_by_simpson_approx.py added * *other/integeration_by_simpson_approx.py Added for integeration * Delete iterating_through_submasks.py * Delete DIRECTORY.md * Revert "updated" This reverts commit 73456f85de03782b7d3c794eca8390a4fe87037c. * changes made *integeration_by_simpson_approx.py * update2 Co-authored-by: Christian Clauss <cclauss@me.com> * Fixed warning string for Key B = 0 (#1639) * Fixed warning string for Key B = 0 * Update affine_cipher.py * Update affine_cipher.py * decrypt_message(encrypt_message()) Co-authored-by: Christian Clauss <cclauss@me.com> * Create roman_to_integer.py (#1636) * added roman to integer conversion (LeetCode No. 13) * updated directory to include Roman to Integer * Delete DIRECTORY.md * Update roman_to_integer.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update binary_search_tree.py (#1339) * Update binary_search_tree.py remove some bugs * Update binary_search_tree.py * Update binary_search_tree.py * Update binary_search_tree.py * Update binary_search_tree.py * Update binary_search_tree.py * Update binary_search_tree.py * testlist = (8, 3, 6, 1, 10, 14, 13, 4, 7) * Update .travis.yml Co-authored-by: Christian Clauss <cclauss@me.com> * Stack using double linked list (#1413) * Stack using double linked list * Test with doctests * Update stack_using_dll.py * Update stack_using_dll.py * Update stack_using_dll.py Co-authored-by: Christian Clauss <cclauss@me.com> * Added binary exponentiaion with respect to modulo (#1428) * Added binary exponentiaion with respect to modulo * Added miller rabin: the probabilistic primality test for large numbers * Removed unused import * Added test for miller_rabin * Add test to binary_exp_mod * Removed test parameter to make Travis CI happy * unittest.main() # doctest: +ELLIPSIS ... * Update binary_exp_mod.py * Update binary_exp_mod.py * Update miller_rabin.py * from .prime_check import prime_check Co-authored-by: Christian Clauss <cclauss@me.com> * Update back_propagation_neural_network.py (#1342) * Update back_propagation_neural_network.py Added comments below functions * Update back_propagation_neural_network.py Co-authored-by: Christian Clauss <cclauss@me.com> * actions/checkout@v2 (#1643) * actions/checkout@v2 https://github.com/actions/checkout/releases * fixup! Format Python code with psf/black push * pyupgrade --py37-plus **/*.py (#1654) * pyupgrade --py37-plus **/*.py * fixup! Format Python code with psf/black push * Dijkstra's Bankers algorithm (#1650) * Dijkstra's Bankers algorithm @bluedistro, Your review please. A second shot at #1645 Implementation of the Dijkstra's Banker's algorithm with test examples and a comprehensible description. * fixup! Format Python code with psf/black push * Delete back_propagation_neural_network.py * Create back_propagation_neural_network.py * fixup! Format Python code with psf/black push * Add files via upload (#1657) * update volumes with type hints + some refactoring (#1353) * update volumes with type hints + some refactoring * added docstrings * Use float instead of ints in doctest results Co-authored-by: Christian Clauss <cclauss@me.com> * Create deque_doubly.py (#1652) * Create deque_doubly.py Implementing Deque ADT using Doubly Linked List.... * Update deque_doubly.py * Update deque_doubly.py Adding doctest * Update doctest of deque_doubly.py * Update deque_doubly.py * linked_list. Co-authored-by: Christian Clauss <cclauss@me.com> * Create get_imdb_top_250_movies_csv.py (#1659) * Create get_imdb_top_250_movies_csv.py * Update get_imdb_top_250_movies_csv.py * Update get_imdb_top_250_movies_csv.py * get_imdb_top_250_movies() Co-authored-by: Christian Clauss <cclauss@me.com> * New Code!!(Finding the N Possible Binary Search Tree and Binary Tree from Given N node Number) (#1663) * Code Upload * Code Upload * Delete n_possible_bst * Find the N Possible Binary Tree and Binary Tree from given Nth Number of Node. * Update in Test * Update and rename n_possible_bst.py to number_of_possible_binary_trees.py Co-authored-by: Christian Clauss <cclauss@me.com> * added hill climbing algorithm (#1666) * added hill climbing algorithm * Shorten long lines, streamline get_neighbors() * Update hill_climbing.py * Update and rename optimization/hill_climbing.py to searches/hill_climbing.py Co-authored-by: Christian Clauss <cclauss@me.com> * number of Possible Binary Search Tree and Binary Tree. (#1670) * Code Upload * Code Upload * Delete n_possible_bst * Find the N Possible Binary Tree and Binary Tree from given Nth Number of Node. * Update in Test * Update and rename n_possible_bst.py to number_of_possible_binary_trees.py Co-authored-by: Christian Clauss <cclauss@me.com> * Typos in comments in hill_climbing.py (#1667) * Typos in comments in hill_climbing.py * fixup! Format Python code with psf/black push * Update and rename lca.py to lowest_common_ancestor.py (#1664) * Update and rename lca.py to lowest_common_ancestor.py * fixup! Format Python code with psf/black push * Added to maths and strings (#1642) * Added to maths and strings * added changes suggest by cclauss * git add DIRECTORY.md (#1674) * git add DIRECTORY.md * updating DIRECTORY.md * Added Strassen divide and conquer algorithm to multiply matrices. (#1648) * Added Strassen divide and conquer algorithm to multiply matrices * Divide and conquer algorith to calculate pow(a,b) or a raised to the power of b * Putting docstring inside the function. * Added doctests * Corrects failing check in master (#1676) * Add a program to evaluate a string in prefix notation (Polish Notation) (#1675) * Create infix_evaluation.py * fix doctests * Rename infix_evaluation.py to prefix_evaluation.py * Add prefix_evaluation.py to directory * A recursive insertion sort (#1683) * A recursive insertion sort * added doctests and typehints * Create pull_request_template.md (#1684) * Create pull_request_template.md * fixup! Format Python code with psf/black push * Update pull_request_template.md * updating DIRECTORY.md * Update pull_request_template.md * Update pull_request_template.md * Update pull_request_template.md * Update pull_request_template.md * Update pull_request_template.md * Typos and formatting Co-authored-by: John Law <johnlaw.po@gmail.com> * enhance swapping code in link (#1660) * enhance swapping code in link * heapify do not recursive * fix * fix identifier and add test * typing.Any and LinkedList instead of Linkedlist * typing.Any and LinkedList instead of Linkedlist * Typo? (#1653) * Typo? newNod -> newNode * newNode -> new_node Co-authored-by: Christian Clauss <cclauss@me.com> * implement max heap and more pythonic (#1685) * implement max heap and more pythonic * add doctests for heap * Implemented Square Root Algorithm (#1687) * Added to maths and strings * added changes suggest by cclauss * added square root function * Fixed type hinting * fixed type error * Fixed another type error * Solution for problem 30 of Euler Project (#1690) * Create soln.py Solution for problem 30 of Euler Project * Update soln.py * update soln.py modified the changes * if __name__ == "__main__": Co-authored-by: Christian Clauss <cclauss@me.com> * Added implementation for simulated annealing (#1679) * added hill climbing algorithm * Shorten long lines, streamline get_neighbors() * Update hill_climbing.py * Update and rename optimization/hill_climbing.py to searches/hill_climbing.py * added hill climbing algorithm * Shorten long lines, streamline get_neighbors() * Update hill_climbing.py * Rebased * added simulated annealing.py * added final comments and test * black formatted * restricted search domain Co-authored-by: Christian Clauss <cclauss@me.com> * Create codespell.yml (#1698) * fixup! Format Python code with psf/black push * Create codespell.yml * fixup! Format Python code with psf/black push * Create factorial_iterative.py (#1693) * Create factorial_iterative.py * Update factorial_iterative.py * Update factorial_iterative.py * Update factorial_iterative.py * print(f"factorial{n} is {factorial(n)}") * Update factorial_recursive.py Co-authored-by: Christian Clauss <cclauss@me.com> * Added an algorithm that approximates line lengths (#1692) * A recursive insertion sort * added doctests and typehints * Added arc length and numerical integration calculators * fixed doc test * Fixed some conversion errors * Fixed some commenting * Deleted numerical integration to allow 1 file per push * Changed string formatting method * Area Under a Curve Algorithm (#1701) * A recursive insertion sort * added doctests and typehints * Added arc length and numerical integration calculators * fixed doc test * Fixed some conversion errors * Fixed some commenting * Deleted numerical integration to allow 1 file per push * Changed string formatting method * Added program to calculate trapezoidal area under curve * Deleted files ensure 1 pull request per file * file name changed * Update area_under_curve.py Co-authored-by: Christian Clauss <cclauss@me.com> * Add Prim's algorithm with min heap (#1704) * Adding Armstrong number (#1708) * Adding Armstrong number * Update armstrong_numbers * Update armstrong_numbers.py * Update armstrong_numbers.py * Update armstrong_numbers.py Co-authored-by: Christian Clauss <cclauss@me.com> * fix comment (#1710) * fix comment * Update armstrong_numbers.py Co-authored-by: Christian Clauss <cclauss@me.com> * codespell --quiet-level=2 (#1711) * codespell --quiet-level=2 Suppress the BINARY FILE warnings * fixup! Format Python code with psf/black push * Added implementation for Bezier Curve, under a new graphics directory. (#1713) * Added bezier curve * black formatted * corrected spell check * edited scipy import * updated documentation for readablitity * Update bezier_curve.py * Update bezier_curve.py Co-authored-by: Christian Clauss <cclauss@me.com> * Mandates referencing issue in PR (#1717) * Mandates referencing issue in PR * Update CONTRIBUTING.md * Update pull_request_template.md * Update pull_request_template.md * Update pull_request_template.md * Update CONTRIBUTING.md Co-authored-by: John Law <johnlaw.po@gmail.com> Co-authored-by: Christian Clauss <cclauss@me.com> * Fix typo (#1718) * Fix typo * updating DIRECTORY.md * Augment binary search algorithms (#1719) * relevant documentation added (#1725) * Implement Manacher's algorithm (#1721) * manacher's algorithm updated * Added first come first served scheduling (#1722) * Added FCFS * Fixed spelling error * Rename fcfs.py to first_come_first_served.py * Fixed FCFS and added tests. * Made changes requested * Use enumerate() instead of range(len()) Co-authored-by: Christian Clauss <cclauss@me.com> * Improve collatz_sequence algorithm (#1726) - Add more doctests and type checking to make sure only natural numbers are used - Simplified the algorithm slightly This new verison is also between 10-15% faster for really long sequences * Added Random Forest Regressor and tested with flake8 (#1733) * Added Random Forest Regressor * Updated file to standard * Travis CI: Don’t allow bare exceptions (#1734) * Travis CI: Don’t allow bare exceptions * fixup! Format Python code with psf/black push * except IOError: * except IOError: * Update hamming_code.py * IndexError * Get rid of the nonsense logic Co-authored-by: John Law <johnlaw.po@gmail.com> * Added a Monte Carlo simulation (#1723) * Added montecarlo.py This algorithm uses a Monte Carlo simulation to estimate the value of pi. * Rename montecarlo.py to maths/montecarlo.py * Add files via upload * Delete montecarlo.py * Rename montecarlo.py to maths/montecarlo.py * Update montecarlo.py * Fixes black failures (#1742) * Fixes LGTM issues (#1745) * Fixes redefinition of a variable * Fixes implementing __eq__ * Updates docstring * Add gitpod config (#1744) * Add gitpod config * Add Gitpod to icon bar * Added DP Solution for Optimal BST Problem (#1740) * Added code to dynamic_programming directory * Added doctest * Elaborated BST * Small tweaks * Update optimal_bst.py * Some touchups * Fixed doctest * Update optimal_bst.py * Update optimal_bst.py * Update optimal_bst.py * Rename optimal_bst.py to optimal_binary_search_tree.py Co-authored-by: Christian Clauss <cclauss@me.com> * Added Bisection algorithm (#1739) * Create Bisection.py Find root of * Update Bisection.py * Update Bisection.py i changed the given function with one that i could make the doctests. * Rename Bisection.py to bisection.py * Update bisection.py * Update bisection.py * Update bisection.py * Update bisection.py * Update bisection.py Made the changes that were requested * Update bisection.py * Update bisection.py * Add wiki url Co-authored-by: Christian Clauss <cclauss@me.com> * Fixes unused variable errors in LGTM (#1746) * Fixes unsed variable errors in LGTM * Fixes integer check * Fixes failing tests * Add Chudnovskys algorithm for calculating many digits of pi (#1752) * Add Chudnovskys algorithm for calculating many digits of pi * Update return value type hint * Initialize partial sum to be of type Decimal * Update chudnovsky_algorithm.py Co-authored-by: Christian Clauss <cclauss@me.com> * Fixes black failures from Previous PR (#1751) * Fixes black failures from Previous PR * Fixes equality testing alert * Fixes call to main() alert * Fixes unused import * Create RayleighQuotient.py (#1749) * Create RayleighQuotient.py https://en.wikipedia.org/wiki/Rayleigh_quotient * Update RayleighQuotient.py * Update and rename RayleighQuotient.py to rayleigh_quotient.py * Update rayleigh_quotient.py * Update rayleigh_quotient.py python/black * Update rayleigh_quotient.py * Created geodesy section with one algorithm (#1757) * implemented haversine * updated docstring Only calculate distance * added type hints * added type hints * improved docstring and math usage * f"{haversine_distance(*SAN_FRANCISCO, *YOSEMITE):0,.0f} meters" Co-authored-by: Christian Clauss <cclauss@me.com> * Add Monte Carlo dice simulation algorithm (#1759) * Implement basic dice simulation * Add tests to throw_dice * Fix comment * Add type hints * Add additional comments * Update monte_carlo_dice.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update quadratic equations solver (#1764) Use pythons complex number module cmath for the calculation of the roots * Added doctests in modular_exponential.py (#1775) * added doctests in modular_exponential.py * added doctests in modular_exponential.py * added URL link * Implemented geodesy - Lambert's ellipsoidal distance (#1763) * Implemented Lambert's long line * Update lamberts_ellipsoidal_distance.py Co-authored-by: John Law <johnlaw.po@gmail.com> * uses: actions/checkout@v2 (#1779) * uses: actions/checkout@v2 * fixup! Format Python code with psf/black push * add example to estimate area under line using montecarlo (#1782) * add example to estimate area under line using montecarlo * separate estimate func and print statements * use mean from stats package * avoid creating extra variable * min_value: float=0.0, max_value: float=1.0 * Update montecarlo.py * Update montecarlo.py * Rename montecarlo.py to monte_carlo.py * Update monte_carlo.py Co-authored-by: Christian Clauss <cclauss@me.com> * extend estimation of area under curve of y=x using monte carlo simulation to any given lower and upper bound (#1784) * extend estimation of area under curve of y=x using monte carlo simulation to any given lower and upper bound * remove doctest * Travis CI: Upgrade to Python 3.8 (#1783) * Travis CI: Upgrade to Python 3.8 * updating DIRECTORY.md * Tensorflow is not yet compatible with Python 3.8 * Disable k_means_clustering_tensorflow.py * updating DIRECTORY.md * Disable gan.py * updating DIRECTORY.md * Disable input_data.py * updating DIRECTORY.md * pip install a current version of six * estimate area under a curve defined by non-negative real-valued continuous function within a continuous interval using monte-carlo (#1785) * estimate area under a curve defined by non-negative real-valued continuous function within a continuous interval using monte-carlo * run black; update comments * Use f”strings” and drop unnecessary returns Co-authored-by: Christian Clauss <cclauss@me.com> * Add bilateral filter (#1786) * Added Bilateral filter * Added Bilateral filter * changed types of varS and varI * formatted with black * added type hints * changed variable names * Update bilateral_filter.py * Drop transitory variables, add parse_args() Co-authored-by: vinayak <itssvinayak@gmail.com> Co-authored-by: Christian Clauss <cclauss@me.com> * Create emails_from_url.py (#1756) * Create emails_from_url.py * Update emails_from_url.py * Update emails_from_url.py * 0 emails found: * Update emails_from_url.py * Use Python set() to remove duplicates * Update emails_from_url.py * Add type hints and doctests Co-authored-by: vinayak <itssvinayak@gmail.com> Co-authored-by: Christian Clauss <cclauss@me.com> * contribution guidelines checks (#1787) * spelling corrections * review * improved documentation, removed redundant variables, added testing * added type hint * camel case to snake case * spelling fix * review * python --> Python # it is a brand name, not a snake * explicit cast to int * spaces in int list * "!= None" to "is not None" * Update comb_sort.py * various spelling corrections in documentation & several variables naming conventions fix * + char in file name * import dependency - bug fix Co-authored-by: John Law <johnlaw.po@gmail.com> * Added SkipList (#1781) * Added SkipList * Add missing type hints and doctests * Add missing doctest * Tighten up doctest Co-authored-by: Christian Clauss <cclauss@me.com> * update rot13.py (#1790) * update rot13.py * Update rot13.py * Type hints, doctests, URL to Wikipedia Co-authored-by: Christian Clauss <cclauss@me.com> * add relu function (#1795) * Added Random Forest Classifier (#1738) * Added Random Forest Regressor * Updated file to standard * Added Random Forest Classifier (Iris dataset) and a Confusion Matrix for result visualization * autoblack: actions/checkout@v1 # Use v1, NOT v2 (#1796) * autoblack: actions/checkout@v1 # Use v1, NOT v2 * fixup! Format Python code with psf/black push Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> * Fix typo (#1797) colision => collision * Effective directory writer (#1800) * updating DIRECTORY.md * Update directory_writer.yml Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> * directory_writer: actions/checkout@v1 # Use v1, NOT v2 (#1799) * directory_writer: actions/checkout@v1 # Use v1, NOT v2 (#1796 * updating DIRECTORY.md * Add Monte Carlo estimation of PI (#1712) * Add Monte Carlo estimation of PI * Add type annotations for Monte Carlo estimation of PI * Compare the PI estimate to PI from the math lib * accuracy -> error * Update pi_monte_carlo_estimation.py Co-authored-by: John Law <johnlaw.po@gmail.com> * Travis CI: Fix Travis linter errors (#1802) * Travis CI: Fix Travis linter errors * fixup! Format Python code with psf/black push * Update .travis.yml * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> * Fix rehashing function will not call insert_data function (#1803) * Fix rehashing function will not call insert_data function * Fix typo * Update loop syntax instead of allocating a list Co-Authored-By: Christian Clauss <cclauss@me.com> Co-authored-by: Christian Clauss <cclauss@me.com> * 'allocation_content_length' (#1808) * 'allocation_content_length' * 'allocation_number' * Delete allocation_content_length.py * Update allocation_number.py * Update allocation_number.py * number_of_bytes and partitions * Update allocation_number.py Co-authored-by: Christian Clauss <cclauss@me.com> * All suggeted changes within additional time limit tests (#1815) * With all suggested changes :white_check_mark: possibly covered all the recommended guidelines * Updated with both slow and faster algorithms possibally covered all the recomendations * removed the time comparision part! * Update data_structures/stacks/next_greater_element.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Update data_structures/stacks/next_greater_element.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Update data_structures/stacks/next_greater_element.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Update data_structures/stacks/next_greater_element.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Add benchmark using timeit https://docs.python.org/3/library/timeit.html The performance delta between these two implementation is quite small... ``` next_greatest_element_slow(): 1.843442126 next_greatest_element(): 1.828941414 ``` * Optimize slow() to create fast() - Three algorithms in the race Three algorithms in the race * Use a bigger test array with floats, negatives, zero * Setup import next_greatest_element_fast Co-authored-by: Christian Clauss <cclauss@me.com> * psf/black changes to next_greater_element.py (#1817) * psf/black changes to next_greater_element.py * fixup! Format Python code with psf/black push Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> * Typo in comment rabin_karp.py (#1820) * Update rabin_karp.py fix: typo * Update rabin_karp.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update reverse_words.py (#1825) The following update results in less lines of code and faster performance while preserving functionality. * Update basic_binary_tree.py (#1833) fixed some grammar mistakes * Update greedy.py (#1832) * Create Python/quantum/README.md (#1834) * Create Python/quantum/README.md Started at #1831 * fixup! Format Python code with psf/black push Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> * Change gitpod configuration for python3. (#1827) * Fix typo "panagram" -> "pangram" (#1836) * Binary search tree using recursion (#1839) * Binary search tree using recursion * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> * Update README.md (#1842) * CONTRIBUTING.md: Fix comments about the black formatter (#1841) * CONTRIBUTING.md: Fix comments about the black formatter Fixes #1840 * Update CONTRIBUTING.md * Update CONTRIBUTING.md * Update FUNDING.yml (#1829) * Update FUNDING.yml * fixup! Format Python code with psf/black push * Update FUNDING.yml * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: Anup Kumar Panwar <1anuppanwar@gmail.com> * Update FUNDING.yml * Added new Algorithm to find middle element of Linked List (#1822) * Added new Algorithm to find middle element of Linked List * Rename MiddleElementOfLinkedList.py to middle_element_of_linked_list.py * changed "middle_element_of_linked_list.py" algorithm for taking input * Update middle_element_of_linked_list.py * Update middle_element_of_linked_list.py * Update middle_element_of_linked_list.py * Update middle_element_of_linked_list.py * Update middle_element_of_linked_list.py * Update middle_element_of_linked_list.py * Update middle_element_of_linked_list.py * Update middle_element_of_linked_list.py * Update middle_element_of_linked_list.py * Whack the trailing whitespace Co-authored-by: Christian Clauss <cclauss@me.com> * README.md: sumab() --> sum_ab() for consistancy (#1855) * README.md: sumab() --> sum_ab() for consistancy consistency * fixup! Format Python code with psf/black push Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> * added add algorithm (#1856) * added add algorithm * Update and rename check/add.py to math/add.py Co-authored-by: Christian Clauss <cclauss@me.com> * Test the exception conditions (#1853) * Text exception conditions These are ValueErrors, not AttributeErrors. * fixup! Format Python code with psf/black push * Update perceptron.py * Update perceptron.py * Update perceptron.py * Revert the test Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> * Fix some typos in random forest classifier (#1858) * Update year in LICENSE.md (#1848) * Rename math/add.py to maths/add.py (#1857) * Rename math/add.py to maths/add.py * fixup! Format Python code with psf/black push * Fix sum to add * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: John Law <johnlaw.po@gmail.com> * Update g_topological_sort.py (#1873) * Create gaussian_naive_bayes.py (#1861) * Create Gaussian_Naive_Bayes.py Added Gaussian Naive Bayes algorithm in the module machine learning * Rename Gaussian_Naive_Bayes.py to gaussian_naive_bayes.py * requirements.txt: pip install xgboost Co-authored-by: Christian Clauss <cclauss@me.com> * CONTRIBUTING.md: What is an Algorithm? (#1885) * CONTRIBUTING.md: What is an Algorithm? We are seeing too many _how-to examples_ for using existing Python packages so we should define what we want algorithm contributions to be. * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> * Update random_forest_regressor.py (#1880) * Update CONTRIBUTING.md (#1886) * Update abbreviation.py (#1887) * Initialize set with source in DFS (#1872) * Update dfs.py * Add type hints, rearrange doc-strings and comments * fixup! Format Python code with psf/black push * dfs -> depth_first_search Co-Authored-By: Christian Clauss <cclauss@me.com> * dfs -> depth_first_search * Add doctest for DFS * fixup! Format Python code with psf/black push * Rename dfs.py to depth_first_search_dictionary.py * updating DIRECTORY.md * Rename depth_first_search_dictionary.py to depth_first_search_dfs.py * updating DIRECTORY.md * Rename depth_first_search.py to depth_first_search_2.py * updating DIRECTORY.md * Rename depth_first_search_dfs.py to depth_first_search.py * updating DIRECTORY.md Co-authored-by: John Law <johnlaw.po@gmail.com> Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: Christian Clauss <cclauss@me.com> * Update breadth_first_search.py (#1869) * Create is_palindrome.py (#1754) * Create is_palindrome.py * Update is_palindrome.py * Update is_palindrome.py Co-authored-by: Christian Clauss <cclauss@me.com> * Create Python/bit_manipulation/README.md (#1897) * Create Python/bit_manipulation/README.md To open up a new area of algorithms... @Shrutikabansal I hope that you will contribute some of your work here. * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> * fix: space count in strings/word_occurrence.py (#1896) * fix: space count in strings/word_occurrence.py * Update strings/word_occurrence.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Update strings/word_occurrence.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Update strings/word_occurrence.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Update word_occurrence.py Seems like, there is no need o `occurrence.pop('', None)` Co-authored-by: Christian Clauss <cclauss@me.com> * Add cellular_automata directory (#1902) Related to https://github.com/TheAlgorithms/Python/issues/1613#issuecomment-618175224 @8Dion8 Your review please. Once this land, this directory would be a great place for you to add your work. * Update linear_search.py (#1906) * Fix typo in Project Euler sol1.py (#1875) * Added sepia tone (#1877) * Add sepia tone * Add unit test * technic --> technique * Update digital_image_processing/sepia.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Update digital_image_processing/sepia.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Fixed errors after commit changes * Fixed errors Co-authored-by: Christian Clauss <cclauss@me.com> * Create one_dimensional.py (#1905) * Create one_dimensional.py * Update cellular_automata/one_dimensional.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Update cellular_automata/one_dimensional.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Update one_dimensional.py Moved import to the top so that the type Image gets recognized * Update one_dimensional.py * Update cellular_automata/one_dimensional.py * Update cellular_automata/one_dimensional.py * Update one_dimensional.py * Update one_dimensional.py * Update one_dimensional.py Co-authored-by: Christian Clauss <cclauss@me.com> * Blacken one_dimensional.py (#1911) * Blacken one_dimensional.py * updating DIRECTORY.md * Travis CI: Upgrade to Ubuntu 20.04 LTS Focal Ubuntu 20.04 LTS (Focal Fossa) https://releases.ubuntu.com/focal Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> * Added A1Z26 Cipher (#1914) * A1Z26 Cipher * A1Z26 Cipher * Added type hints * Added Doctests * removed tabs, spaces instead * corrected doctest * corrected doctest * info URLs added * Condensed decode to one line * Condensed encode function to a single line * Nice one! Co-authored-by: Christian Clauss <cclauss@me.com> * Added Burkes dithering algorithm. (#1916) * Added Burkes dithering algorithm * Added unit tests for burkes algorithm * Fix burkes algorithm * Added some additional information * Fixed CI tests * Update digital_image_processing/dithering/burkes.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Update digital_image_processing/dithering/burkes.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Update digital_image_processing/dithering/burkes.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Propogate the += and add a doctest * Fix doctest * @staticmethod --> @ classmethod to ease testing * def test_burkes(file_path): * Fix for mypy checks * Fix variable order in get_greyscale * Fix get_greyscale method * Fix get_greyscale method * 3.753 Co-authored-by: Christian Clauss <cclauss@me.com> * Fix invalid escape sequence in binary_search_tree.py (#1920) * Fix invalid escape sequence in binary_search_tree.py data_structures/binary_tree/binary_search_tree.py:156 /home/travis/build/TheAlgorithms/Python/data_structures/binary_tree/binary_search_tree.py:156: DeprecationWarning: invalid escape sequence \ * fixup! Format Python code with psf/black push Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> * Graph coloring (#1921) * add skeleton code * add doctests * add mainc function pseudo code and tests (ToDo: write Implementation) * typo fixes * implement algorithm * add type checking * add wikipedia link * typo fix * update range syntax Co-authored-by: Christian Clauss <cclauss@me.com> * change indexed iteration checking to any() Co-authored-by: Christian Clauss <cclauss@me.com> * fix: swap import and documentation sections * fix: change return none to return empty list * remove unnecessary import (Union) * change: remove returning boolean indicating problem was solved or not * remove unnecessary import (Tuple) Co-authored-by: Christian Clauss <cclauss@me.com> * Add shortest path by BFS (#1870) * Create breadth_first_search_shortest_path.py * updating DIRECTORY.md * Reduce side effect of `shortest_path` For the sake of future testing and documentation - * fixup! Format Python code with psf/black push * Fix typo `separately` * Change to get() from dictionary Co-Authored-By: Christian Clauss <cclauss@me.com> * Move graph to the top * fixup! Format Python code with psf/black push * Add doctest for shortest path * Add doctest for BFS * fixup! Format Python code with psf/black push * Add typings for breadth_first_search_shortest_path * fixup! Format Python code with psf/black push * Remove assert from doctests * Add blank line to doctest Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: John Law <johnlaw.po@gmail.com> Co-authored-by: Christian Clauss <cclauss@me.com> Co-authored-by: John Law <johnlaw@linux.com> * Changed the deprecated `np.matrix` to `np.ndarray` (#1923) * Wrap lines that go beyond GitHub Editor (#1925) * Wrap lines that go beyond GiHub Editor * flake8 --count --select=E501 --max-line-length=127 * updating DIRECTORY.md * Update strassen_matrix_multiplication.py * fixup! Format Python code with psf/black push * Update decision_tree.py Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> * Update stale comment (#1924) * Update close comment * Update stale.yml * Multiline strings in yaml files https://yaml-multiline.info/ Co-authored-by: John Law <johnlaw.po@gmail.com> Co-authored-by: Christian Clauss <cclauss@me.com> * Hamiltonian Cycle (#1930) * add skeleton code * add doctests * add tests for util function + implement wrapper * full implementation * add ability to add starting verex for algorithm * add static type checking * add doc tests to validation method * bug fix: doctests expected failing * Update hamiltonian_cycle.py * Update hamiltonian_cycle.py Co-authored-by: Christian Clauss <cclauss@me.com> * support_vector_machines.py increase error tolerance to suppress convergence warnings (#1929) * Update support_vector_machines.py * Update support_vector_machines.py Co-authored-by: Christian Clauss <cclauss@me.com> * enhanced segment tree implementation and more pythonic (#1715) * enhanced segment tree implementation and more pythonic enhanced segment tree implementation and more pythonic * add doctests for segment tree * add type annotations * unified processing sum min max segment tre * delete source encoding in segment tree * use a generator function instead of returning * add doctests for methods * add doctests for methods * add doctests * fix doctest * fix doctest * fix doctest * fix function parameter and fix determine conditions * Check if a item exist in stack or not (#1931) * Check if a item exist in stack or not * implemented __contains__ method in stack * made changes in __contains__ * added method for checking armstrong number (#1936) * added method for checking armstrong number * Update comment Co-authored-by: Christian Clauss <cclauss@me.com> * Solution for Euler Problem 26 (#1939) * Solution for Euler Problem 26 * Update project_euler/problem_26/sol1.py typo error fix. Co-authored-by: Christian Clauss <cclauss@me.com> * Update project_euler/problem_26/sol1.py typo error fix Co-authored-by: Christian Clauss <cclauss@me.com> * Update project_euler/problem_26/sol1.py ok to remove, this comes from Pycharm automatically when docstring is added. Co-authored-by: Christian Clauss <cclauss@me.com> * Update project_euler/problem_26/sol1.py ok to remove. Co-authored-by: Christian Clauss <cclauss@me.com> * Update project_euler/problem_26/sol1.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update project_euler/problem_26/sol1.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update project_euler/problem_26/sol1.py Co-authored-by: Christian Clauss <cclauss@me.com> * now_divide = now_divide * 10 % divide_by_number Co-authored-by: Christian Clauss <cclauss@me.com> * Fix psf/black issues than fail the build (#1935) * Fix psf/black issues than fail the build * fixup! Format Python code with psf/black push Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> * Delete FUNDING.yml * Create sol2.py (#1876) * Create sol2.py * updating DIRECTORY.md * Update DIRECTORY.md * updating DIRECTORY.md * Update sol2.py * Update DIRECTORY.md * updating DIRECTORY.md * Improve docstrings Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: vinayak <itssvinayak@gmail.com> Co-authored-by: John Law <johnlaw@linux.com> * Deal with maps (#1945) * Deal with maps Try with the search term "pizza" to see why this was done in #1932 * fixup! Format Python code with psf/black push * Update armstrong_numbers.py * updating DIRECTORY.md * Update crawl_google_results.py Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> * change method name from front to get_front (#1943) Co-authored-by: “Vipul <“vipulrai8891@gmail.com”> * Added new algorithm: cracking caesar cipher with the chi-squared test (#1950) * added decrypt_caesar_with_chi_squared.py and ran all checks * Updated default parameters Removed mistake with mutable default arguments Co-authored-by: Christian Clauss <cclauss@me.com> * Updated handling for optional arguments Co-authored-by: Christian Clauss <cclauss@me.com> * Changed return statement to tuple Made function return a tuple instead of a list * Added more doctests * Fixed spelling mistakes * black . - reformatted decrypt_caesar_with_chi_squared.py * Updated if statements to fit the updated code * Minimized amount of lines in the code. Co-authored-by: Christian Clauss <cclauss@me.com> * Added Lstm example for stock predection (#1908) * Added Lstm example for stock predection * Changes after review * changes after build failed * Add Kiera’s to requirements.txt * requirements.txt: Add keras and tensorflow * psf/black Co-authored-by: Christian Clauss <cclauss@me.com> * Added Shortest Job First Algorithm (#1957) * Added Shortest Job First Algorithm It is in IPYNB format but the dataframes are really looking good. Please, take a look. * Delete Shortest_Job_First_Algorithm.ipynb * Added Shortest Job First Algorithm * Update Shortest_Job_First Algorithm.py * Update Shortest_Job_First Algorithm.py * Update Shortest_Job_first Algorithm * Added Shortest_Job_First Algorithm * Added Shortest Job First Algorithm * Update shortest_job_first_algorithm.py * Format code with psf/black Co-authored-by: Christian Clauss <cclauss@me.com> * Add sleep-sort (#1867) * added sleepsort Adding sleepsort * Add doctest and typing for sleepsort * Use self-descriptive variable name * Update sleepsort.py * Update sorts/sleepsort.py Co-authored-by: John Law <johnlaw.po@gmail.com> Co-authored-by: Christian Clauss <cclauss@me.com> * Add graphs/frequent_pattern_graph_miner.py (#1866) * Add files via upload * Update graphs/frequent_pattern_graph_miner.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Update graphs/frequent_pattern_graph_miner.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Update frequent_pattern_graph_miner.py * Update frequent_pattern_graph_miner.py * Update frequent_pattern_graph_miner.py * Update frequent_pattern_graph_miner.py * Update graphs/frequent_pattern_graph_miner.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Update graphs/frequent_pattern_graph_miner.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Update graphs/frequent_pattern_graph_miner.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Update graphs/frequent_pattern_graph_miner.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Update graphs/frequent_pattern_graph_miner.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Update graphs/frequent_pattern_graph_miner.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Update graphs/frequent_pattern_graph_miner.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Update graphs/frequent_pattern_graph_miner.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Update frequent_pattern_graph_miner.py * Update frequent_pattern_graph_miner.py * Update frequent_pattern_graph_miner.py * Update frequent_pattern_graph_miner.py * Update frequent_pattern_graph_miner.py * Update graphs/frequent_pattern_graph_miner.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Update frequent_pattern_graph_miner.py * Update frequent_pattern_graph_miner.py * Update frequent_pattern_graph_miner.py * Update frequent_pattern_graph_miner.py * Update frequent_pattern_graph_miner.py * Update frequent_pattern_graph_miner.py * Update graphs/frequent_pattern_graph_miner.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Update frequent_pattern_graph_miner.py * Update frequent_pattern_graph_miner.py * Update frequent_pattern_graph_miner.py * Update frequent_pattern_graph_miner.py * Update frequent_pattern_graph_miner.py * Update frequent_pattern_graph_miner.py * Update frequent_pattern_graph_miner.py * Whitespace changes * Format with psf/black Co-authored-by: Christian Clauss <cclauss@me.com> * Added Nearest neighbour algorithm (#1934) * Upgrades to caesar_cipher.py (#1958) * Added more flexibility to functions, decreased amount of repeating code * Added docstrings * Updated input functions * Added doctests * removed test piece of code * black . * Updated caesar cipher standard alphabet to fit python 3.8 * Update and rename sleepsort.py to sleep_sort.py * Or 4 Co-authored-by: Christian Clauss <cclauss@me.com> * Travis CI: lint for useless backslashes (#1961) * Travis CI: lint for useless backslashes * updating DIRECTORY.md * flake8 --max-complexity=25 Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> * Kadanes_algorithm (#1959) * Add files via upl…
stokhos
pushed a commit
to stokhos/Python
that referenced
this pull request
Jan 3, 2021
* Implement basic dice simulation * Add tests to throw_dice * Fix comment * Add type hints * Add additional comments * Update monte_carlo_dice.py Co-authored-by: Christian Clauss <cclauss@me.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe your change:
I made a program to find the probability of a sum appearing when throwing dices.
Checklist:
Fixes: #{$ISSUE_NO}
.