diff --git a/Analysis/Compression_Analysis/compressed_image.png b/analysis/compression_analysis/compressed_image.png similarity index 100% rename from Analysis/Compression_Analysis/compressed_image.png rename to analysis/compression_analysis/compressed_image.png diff --git a/Analysis/Compression_Analysis/example_image.jpg b/analysis/compression_analysis/example_image.jpg similarity index 100% rename from Analysis/Compression_Analysis/example_image.jpg rename to analysis/compression_analysis/example_image.jpg diff --git a/Analysis/Compression_Analysis/orignal_image.png b/analysis/compression_analysis/orignal_image.png similarity index 100% rename from Analysis/Compression_Analysis/orignal_image.png rename to analysis/compression_analysis/orignal_image.png diff --git a/Analysis/Compression_Analysis/PSNR.py b/analysis/compression_analysis/psnr.py similarity index 100% rename from Analysis/Compression_Analysis/PSNR.py rename to analysis/compression_analysis/psnr.py diff --git a/ArithmeticAnalysis/Bisection.py b/arithmetic_analysis/bisection.py similarity index 100% rename from ArithmeticAnalysis/Bisection.py rename to arithmetic_analysis/bisection.py diff --git a/ArithmeticAnalysis/Intersection.py b/arithmetic_analysis/intersection.py similarity index 100% rename from ArithmeticAnalysis/Intersection.py rename to arithmetic_analysis/intersection.py diff --git a/ArithmeticAnalysis/LUdecomposition.py b/arithmetic_analysis/lu_decomposition.py similarity index 100% rename from ArithmeticAnalysis/LUdecomposition.py rename to arithmetic_analysis/lu_decomposition.py diff --git a/ArithmeticAnalysis/NewtonMethod.py b/arithmetic_analysis/newton_method.py similarity index 100% rename from ArithmeticAnalysis/NewtonMethod.py rename to arithmetic_analysis/newton_method.py diff --git a/ArithmeticAnalysis/NewtonRaphsonMethod.py b/arithmetic_analysis/newton_raphson_method.py similarity index 100% rename from ArithmeticAnalysis/NewtonRaphsonMethod.py rename to arithmetic_analysis/newton_raphson_method.py diff --git a/boolean_algebra/Quine_McCluskey/QuineMcCluskey.py b/boolean_algebra/quine_mc_cluskey.py similarity index 93% rename from boolean_algebra/Quine_McCluskey/QuineMcCluskey.py rename to boolean_algebra/quine_mc_cluskey.py index ff2df5117..db4d153cb 100644 --- a/boolean_algebra/Quine_McCluskey/QuineMcCluskey.py +++ b/boolean_algebra/quine_mc_cluskey.py @@ -99,8 +99,8 @@ def prime_implicant_chart(prime_implicants, binary): return chart def main(): - no_of_variable = int(raw_input("Enter the no. of variables\n")) - minterms = [int(x) for x in raw_input("Enter the decimal representation of Minterms 'Spaces Seprated'\n").split()] + no_of_variable = int(input("Enter the no. of variables\n")) + minterms = [int(x) for x in input("Enter the decimal representation of Minterms 'Spaces Seprated'\n").split()] binary = decimal_to_binary(no_of_variable, minterms) prime_implicants = check(binary) @@ -113,4 +113,4 @@ def main(): print(essential_prime_implicants) if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/ciphers/affine_cipher.py b/ciphers/affine_cipher.py index a2d30b43a..4fbe87d42 100644 --- a/ciphers/affine_cipher.py +++ b/ciphers/affine_cipher.py @@ -4,9 +4,9 @@ import sys, random, cryptomath_module as cryptoMath SYMBOLS = """ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~""" def main(): - message = raw_input('Enter message: ') - key = int(raw_input('Enter key [2000 - 9000]: ')) - mode = raw_input('Encrypt/Decrypt [E/D]: ') + message = input('Enter message: ') + key = int(input('Enter key [2000 - 9000]: ')) + mode = input('Encrypt/Decrypt [E/D]: ') if mode.lower().startswith('e'): mode = 'encrypt' diff --git a/ciphers/brute-force_caesar_cipher.py b/ciphers/brute_force_caesar_cipher.py similarity index 97% rename from ciphers/brute-force_caesar_cipher.py rename to ciphers/brute_force_caesar_cipher.py index 8582249c8..3b0716442 100644 --- a/ciphers/brute-force_caesar_cipher.py +++ b/ciphers/brute_force_caesar_cipher.py @@ -44,7 +44,7 @@ def decrypt(message): print("Decryption using Key #%s: %s" % (key, translated)) def main(): - message = raw_input("Encrypted message: ") + message = input("Encrypted message: ") message = message.upper() decrypt(message) diff --git a/ciphers/caesar_cipher.py b/ciphers/caesar_cipher.py index 19d4478e6..63c5a0608 100644 --- a/ciphers/caesar_cipher.py +++ b/ciphers/caesar_cipher.py @@ -40,25 +40,25 @@ def main(): print("3.BruteForce") print("4.Quit") while True: - choice = raw_input("What would you like to do?: ") + choice = input("What would you like to do?: ") if choice not in ['1', '2', '3', '4']: print ("Invalid choice") elif choice == '1': - strng = raw_input("Please enter the string to be ecrypted: ") + strng = input("Please enter the string to be ecrypted: ") while True: key = int(input("Please enter off-set between 1-94: ")) if key in range(1, 95): print (encrypt(strng, key)) main() elif choice == '2': - strng = raw_input("Please enter the string to be decrypted: ") + strng = input("Please enter the string to be decrypted: ") while True: key = raw_int(input("Please enter off-set between 1-94: ")) if key > 0 and key <= 94: print(decrypt(strng, key)) main() elif choice == '3': - strng = raw_input("Please enter the string to be decrypted: ") + strng = input("Please enter the string to be decrypted: ") brute_force(strng) main() elif choice == '4': diff --git a/ciphers/Onepad_Cipher.py b/ciphers/onepad_cipher.py similarity index 100% rename from ciphers/Onepad_Cipher.py rename to ciphers/onepad_cipher.py diff --git a/ciphers/Prehistoric Men.txt b/ciphers/prehistoric_men.txt similarity index 100% rename from ciphers/Prehistoric Men.txt rename to ciphers/prehistoric_men.txt diff --git a/ciphers/rsa_cipher.py b/ciphers/rsa_cipher.py index ab8329428..94f69ddc2 100644 --- a/ciphers/rsa_cipher.py +++ b/ciphers/rsa_cipher.py @@ -6,7 +6,7 @@ BYTE_SIZE = 256 def main(): filename = 'encrypted_file.txt' - response = raw_input('Encrypte\Decrypt [e\d]: ') + response = input('Encrypte\Decrypt [e\d]: ') if response.lower().startswith('e'): mode = 'encrypt' diff --git a/ciphers/simple_substitution_cipher.py b/ciphers/simple_substitution_cipher.py index fe013cd58..1bdd7dc04 100644 --- a/ciphers/simple_substitution_cipher.py +++ b/ciphers/simple_substitution_cipher.py @@ -4,9 +4,9 @@ import sys, random LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' def main(): - message = raw_input('Enter message: ') + message = input('Enter message: ') key = 'LFWOAYUISVKMNXPBDCRJTQEGHZ' - resp = raw_input('Encrypt/Decrypt [e/d]: ') + resp = input('Encrypt/Decrypt [e/d]: ') checkValidKey(key) diff --git a/ciphers/transposition_cipher.py b/ciphers/transposition_cipher.py index 07f58c632..dbb358315 100644 --- a/ciphers/transposition_cipher.py +++ b/ciphers/transposition_cipher.py @@ -2,9 +2,9 @@ from __future__ import print_function import math def main(): - message = raw_input('Enter message: ') - key = int(raw_input('Enter key [2-%s]: ' % (len(message) - 1))) - mode = raw_input('Encryption/Decryption [e/d]: ') + message = input('Enter message: ') + key = int(input('Enter key [2-%s]: ' % (len(message) - 1))) + mode = input('Encryption/Decryption [e/d]: ') if mode.lower().startswith('e'): text = encryptMessage(key, message) diff --git a/ciphers/transposition_cipher_encrypt-decrypt_file.py b/ciphers/transposition_cipher_encrypt_decrypt_file.py similarity index 89% rename from ciphers/transposition_cipher_encrypt-decrypt_file.py rename to ciphers/transposition_cipher_encrypt_decrypt_file.py index 5c3eaaca6..57620d839 100644 --- a/ciphers/transposition_cipher_encrypt-decrypt_file.py +++ b/ciphers/transposition_cipher_encrypt_decrypt_file.py @@ -5,15 +5,15 @@ import transposition_cipher as transCipher def main(): inputFile = 'Prehistoric Men.txt' outputFile = 'Output.txt' - key = int(raw_input('Enter key: ')) - mode = raw_input('Encrypt/Decrypt [e/d]: ') + key = int(input('Enter key: ')) + mode = input('Encrypt/Decrypt [e/d]: ') if not os.path.exists(inputFile): print('File %s does not exist. Quitting...' % inputFile) sys.exit() if os.path.exists(outputFile): print('Overwrite %s? [y/n]' % outputFile) - response = raw_input('> ') + response = input('> ') if not response.lower().startswith('y'): sys.exit() diff --git a/ciphers/vigenere_cipher.py b/ciphers/vigenere_cipher.py index 34f49c3c0..5d5be0792 100644 --- a/ciphers/vigenere_cipher.py +++ b/ciphers/vigenere_cipher.py @@ -2,9 +2,9 @@ from __future__ import print_function LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' def main(): - message = raw_input('Enter message: ') - key = raw_input('Enter key [alphanumeric]: ') - mode = raw_input('Encrypt/Decrypt [e/d]: ') + message = input('Enter message: ') + key = input('Enter key [alphanumeric]: ') + mode = input('Encrypt/Decrypt [e/d]: ') if mode.lower().startswith('e'): mode = 'encrypt' diff --git a/ciphers/XOR_cipher.py b/ciphers/xor_cipher.py similarity index 100% rename from ciphers/XOR_cipher.py rename to ciphers/xor_cipher.py diff --git a/data_structures/Arrays.py b/data_structures/arrays.py similarity index 100% rename from data_structures/Arrays.py rename to data_structures/arrays.py diff --git a/data_structures/AVL/AVL.py b/data_structures/avl.py similarity index 100% rename from data_structures/AVL/AVL.py rename to data_structures/avl.py diff --git a/data_structures/Binary Tree/binary_search_tree.py b/data_structures/binary tree/binary_search_tree.py similarity index 100% rename from data_structures/Binary Tree/binary_search_tree.py rename to data_structures/binary tree/binary_search_tree.py diff --git a/data_structures/Binary Tree/FenwickTree.py b/data_structures/binary tree/fenwick_tree.py similarity index 100% rename from data_structures/Binary Tree/FenwickTree.py rename to data_structures/binary tree/fenwick_tree.py diff --git a/data_structures/Binary Tree/LazySegmentTree.py b/data_structures/binary tree/lazy_segment_tree.py similarity index 100% rename from data_structures/Binary Tree/LazySegmentTree.py rename to data_structures/binary tree/lazy_segment_tree.py diff --git a/data_structures/Binary Tree/SegmentTree.py b/data_structures/binary tree/segment_tree similarity index 100% rename from data_structures/Binary Tree/SegmentTree.py rename to data_structures/binary tree/segment_tree diff --git a/data_structures/Graph/BellmanFord.py b/data_structures/graph/bellman_ford.py similarity index 78% rename from data_structures/Graph/BellmanFord.py rename to data_structures/graph/bellman_ford.py index f5e1ac983..82db80546 100644 --- a/data_structures/Graph/BellmanFord.py +++ b/data_structures/graph/bellman_ford.py @@ -35,8 +35,8 @@ def BellmanFord(graph, V, E, src): #MAIN -V = int(raw_input("Enter number of vertices: ")) -E = int(raw_input("Enter number of edges: ")) +V = int(input("Enter number of vertices: ")) +E = int(input("Enter number of edges: ")) graph = [dict() for j in range(E)] @@ -45,10 +45,10 @@ for i in range(V): for i in range(E): print("\nEdge ",i+1) - src = int(raw_input("Enter source:")) - dst = int(raw_input("Enter destination:")) - weight = float(raw_input("Enter weight:")) + src = int(input("Enter source:")) + dst = int(input("Enter destination:")) + weight = float(input("Enter weight:")) graph[i] = {"src": src,"dst": dst, "weight": weight} -gsrc = int(raw_input("\nEnter shortest path source:")) +gsrc = int(input("\nEnter shortest path source:")) BellmanFord(graph, V, E, gsrc) diff --git a/data_structures/Graph/BreadthFirstSearch.py b/data_structures/graph/breadth_first_search.py similarity index 100% rename from data_structures/Graph/BreadthFirstSearch.py rename to data_structures/graph/breadth_first_search.py diff --git a/data_structures/Graph/DepthFirstSearch.py b/data_structures/graph/depth_first_search.py similarity index 100% rename from data_structures/Graph/DepthFirstSearch.py rename to data_structures/graph/depth_first_search.py diff --git a/data_structures/Graph/Dijkstra.py b/data_structures/graph/dijkstra.py similarity index 78% rename from data_structures/Graph/Dijkstra.py rename to data_structures/graph/dijkstra.py index 2580dd2f0..891717141 100644 --- a/data_structures/Graph/Dijkstra.py +++ b/data_structures/graph/dijkstra.py @@ -38,8 +38,8 @@ def Dijkstra(graph, V, src): #MAIN -V = int(raw_input("Enter number of vertices: ")) -E = int(raw_input("Enter number of edges: ")) +V = int(input("Enter number of vertices: ")) +E = int(input("Enter number of edges: ")) graph = [[float('inf') for i in range(V)] for j in range(V)] @@ -48,10 +48,10 @@ for i in range(V): for i in range(E): print("\nEdge ",i+1) - src = int(raw_input("Enter source:")) - dst = int(raw_input("Enter destination:")) - weight = float(raw_input("Enter weight:")) + src = int(input("Enter source:")) + dst = int(input("Enter destination:")) + weight = float(input("Enter weight:")) graph[src][dst] = weight -gsrc = int(raw_input("\nEnter shortest path source:")) +gsrc = int(input("\nEnter shortest path source:")) Dijkstra(graph, V, gsrc) diff --git a/data_structures/Graph/dijkstra_algorithm.py b/data_structures/graph/dijkstra_algorithm.py similarity index 100% rename from data_structures/Graph/dijkstra_algorithm.py rename to data_structures/graph/dijkstra_algorithm.py diff --git a/data_structures/Graph/even_tree.py b/data_structures/graph/even_tree.py similarity index 100% rename from data_structures/Graph/even_tree.py rename to data_structures/graph/even_tree.py diff --git a/data_structures/Graph/FloydWarshall.py b/data_structures/graph/floyd_warshall.py similarity index 80% rename from data_structures/Graph/FloydWarshall.py rename to data_structures/graph/floyd_warshall.py index 64d41c2f8..fae8b19b3 100644 --- a/data_structures/Graph/FloydWarshall.py +++ b/data_structures/graph/floyd_warshall.py @@ -30,8 +30,8 @@ def FloydWarshall(graph, V): #MAIN -V = int(raw_input("Enter number of vertices: ")) -E = int(raw_input("Enter number of edges: ")) +V = int(input("Enter number of vertices: ")) +E = int(input("Enter number of edges: ")) graph = [[float('inf') for i in range(V)] for j in range(V)] @@ -40,9 +40,9 @@ for i in range(V): for i in range(E): print("\nEdge ",i+1) - src = int(raw_input("Enter source:")) - dst = int(raw_input("Enter destination:")) - weight = float(raw_input("Enter weight:")) + src = int(input("Enter source:")) + dst = int(input("Enter destination:")) + weight = float(input("Enter weight:")) graph[src][dst] = weight FloydWarshall(graph, V) diff --git a/data_structures/Graph/Graph.py b/data_structures/graph/graph.py similarity index 100% rename from data_structures/Graph/Graph.py rename to data_structures/graph/graph.py diff --git a/data_structures/Graph/Graph_list.py b/data_structures/graph/graph_list.py similarity index 100% rename from data_structures/Graph/Graph_list.py rename to data_structures/graph/graph_list.py diff --git a/data_structures/Graph/Graph_matrix.py b/data_structures/graph/graph_matrix.py similarity index 100% rename from data_structures/Graph/Graph_matrix.py rename to data_structures/graph/graph_matrix.py diff --git a/data_structures/Heap/heap.py b/data_structures/heap/heap.py similarity index 100% rename from data_structures/Heap/heap.py rename to data_structures/heap/heap.py diff --git a/data_structures/LinkedList/__init__.py b/data_structures/linked_list/__init__.py similarity index 100% rename from data_structures/LinkedList/__init__.py rename to data_structures/linked_list/__init__.py diff --git a/data_structures/LinkedList/DoublyLinkedList.py b/data_structures/linked_list/doubly_linked_list.py similarity index 100% rename from data_structures/LinkedList/DoublyLinkedList.py rename to data_structures/linked_list/doubly_linked_list.py diff --git a/data_structures/LinkedList/singly_LinkedList.py b/data_structures/linked_list/singly_linked_list.py similarity index 100% rename from data_structures/LinkedList/singly_LinkedList.py rename to data_structures/linked_list/singly_linked_list.py diff --git a/data_structures/Queue/__init__.py b/data_structures/queue/__init__.py similarity index 100% rename from data_structures/Queue/__init__.py rename to data_structures/queue/__init__.py diff --git a/data_structures/Queue/DeQueue.py b/data_structures/queue/deqeue.py similarity index 100% rename from data_structures/Queue/DeQueue.py rename to data_structures/queue/deqeue.py diff --git a/data_structures/Queue/QueueOnList.py b/data_structures/queue/queue_on_list.py similarity index 100% rename from data_structures/Queue/QueueOnList.py rename to data_structures/queue/queue_on_list.py diff --git a/data_structures/Queue/QueueOnPseudoStack.py b/data_structures/queue/queue_on_pseudo_stack.py similarity index 100% rename from data_structures/Queue/QueueOnPseudoStack.py rename to data_structures/queue/queue_on_pseudo_stack.py diff --git a/data_structures/Stacks/__init__.py b/data_structures/stacks/__init__.py similarity index 100% rename from data_structures/Stacks/__init__.py rename to data_structures/stacks/__init__.py diff --git a/data_structures/Stacks/balanced_parentheses.py b/data_structures/stacks/balanced_parentheses.py similarity index 100% rename from data_structures/Stacks/balanced_parentheses.py rename to data_structures/stacks/balanced_parentheses.py diff --git a/data_structures/Stacks/infix_to_postfix_conversion.py b/data_structures/stacks/infix_to_postfix_conversion.py similarity index 100% rename from data_structures/Stacks/infix_to_postfix_conversion.py rename to data_structures/stacks/infix_to_postfix_conversion.py diff --git a/data_structures/Stacks/next.py b/data_structures/stacks/next.py similarity index 100% rename from data_structures/Stacks/next.py rename to data_structures/stacks/next.py diff --git a/data_structures/Stacks/stack.py b/data_structures/stacks/stack.py similarity index 100% rename from data_structures/Stacks/stack.py rename to data_structures/stacks/stack.py diff --git a/data_structures/Stacks/Stock-Span-Problem.py b/data_structures/stacks/stock_span_problem.py similarity index 100% rename from data_structures/Stacks/Stock-Span-Problem.py rename to data_structures/stacks/stock_span_problem.py diff --git a/data_structures/Trie/Trie.py b/data_structures/trie/trie.py similarity index 100% rename from data_structures/Trie/Trie.py rename to data_structures/trie/trie.py diff --git a/data_structures/UnionFind/__init__.py b/data_structures/union_find/__init__.py similarity index 100% rename from data_structures/UnionFind/__init__.py rename to data_structures/union_find/__init__.py diff --git a/data_structures/UnionFind/tests_union_find.py b/data_structures/union_find/tests_union_find.py similarity index 100% rename from data_structures/UnionFind/tests_union_find.py rename to data_structures/union_find/tests_union_find.py diff --git a/data_structures/UnionFind/union_find.py b/data_structures/union_find/union_find.py similarity index 100% rename from data_structures/UnionFind/union_find.py rename to data_structures/union_find/union_find.py diff --git a/dynamic_programming/FloydWarshall.py b/dynamic_programming/floyd_warshall.py similarity index 100% rename from dynamic_programming/FloydWarshall.py rename to dynamic_programming/floyd_warshall.py diff --git a/File_Transfer_Protocol/ftp_client_server.py b/file_transfer_protocol/ftp_client_server.py similarity index 100% rename from File_Transfer_Protocol/ftp_client_server.py rename to file_transfer_protocol/ftp_client_server.py diff --git a/File_Transfer_Protocol/ftp_send_receive.py b/file_transfer_protocol/ftp_send_receive.py similarity index 100% rename from File_Transfer_Protocol/ftp_send_receive.py rename to file_transfer_protocol/ftp_send_receive.py diff --git a/Graphs/a_star.py b/graphs/a_star.py similarity index 100% rename from Graphs/a_star.py rename to graphs/a_star.py diff --git a/Graphs/ArticulationPoints.py b/graphs/articulation_points.py similarity index 100% rename from Graphs/ArticulationPoints.py rename to graphs/articulation_points.py diff --git a/Graphs/basic-graphs.py b/graphs/basic_graphs.py similarity index 100% rename from Graphs/basic-graphs.py rename to graphs/basic_graphs.py diff --git a/Graphs/CheckBipartiteGraph_BFS.py b/graphs/check_bipartite_graph_bfs.py similarity index 100% rename from Graphs/CheckBipartiteGraph_BFS.py rename to graphs/check_bipartite_graph_bfs.py diff --git a/Graphs/FindingBridges.py b/graphs/finding_bridges.py similarity index 100% rename from Graphs/FindingBridges.py rename to graphs/finding_bridges.py diff --git a/Graphs/KahnsAlgorithm_long.py b/graphs/kahns_algorithm_long.py similarity index 100% rename from Graphs/KahnsAlgorithm_long.py rename to graphs/kahns_algorithm_long.py diff --git a/Graphs/KahnsAlgorithm_topo.py b/graphs/kahns_algorithm_topo.py similarity index 100% rename from Graphs/KahnsAlgorithm_topo.py rename to graphs/kahns_algorithm_topo.py diff --git a/Graphs/minimum_spanning_tree_kruskal.py b/graphs/minimum_spanning_tree_kruskal.py similarity index 85% rename from Graphs/minimum_spanning_tree_kruskal.py rename to graphs/minimum_spanning_tree_kruskal.py index 930aab225..81d64f421 100644 --- a/Graphs/minimum_spanning_tree_kruskal.py +++ b/graphs/minimum_spanning_tree_kruskal.py @@ -1,10 +1,10 @@ from __future__ import print_function -num_nodes, num_edges = list(map(int,raw_input().split())) +num_nodes, num_edges = list(map(int,input().split())) edges = [] for i in range(num_edges): - node1, node2, cost = list(map(int,raw_input().split())) + node1, node2, cost = list(map(int,input().split())) edges.append((i,node1,node2,cost)) edges = sorted(edges, key=lambda edge: edge[3]) diff --git a/Graphs/MinimumSpanningTree_Prims.py b/graphs/minimum_spanning_tree_prims.py similarity index 97% rename from Graphs/MinimumSpanningTree_Prims.py rename to graphs/minimum_spanning_tree_prims.py index 569e73e0a..7b1ad0e74 100644 --- a/Graphs/MinimumSpanningTree_Prims.py +++ b/graphs/minimum_spanning_tree_prims.py @@ -101,8 +101,8 @@ def PrimsAlgorithm(l): return TreeEdges # < --------- Prims Algorithm --------- > -n = int(raw_input("Enter number of vertices: ")) -e = int(raw_input("Enter number of edges: ")) +n = int(input("Enter number of vertices: ")) +e = int(input("Enter number of edges: ")) adjlist = defaultdict(list) for x in range(e): l = [int(x) for x in input().split()] diff --git a/Graphs/Multi_Hueristic_Astar.py b/graphs/multi_hueristic_astar.py similarity index 100% rename from Graphs/Multi_Hueristic_Astar.py rename to graphs/multi_hueristic_astar.py diff --git a/Graphs/scc_kosaraju.py b/graphs/scc_kosaraju.py similarity index 91% rename from Graphs/scc_kosaraju.py rename to graphs/scc_kosaraju.py index 90d3568fa..1f13ebaba 100644 --- a/Graphs/scc_kosaraju.py +++ b/graphs/scc_kosaraju.py @@ -1,12 +1,12 @@ from __future__ import print_function # n - no of nodes, m - no of edges -n, m = list(map(int,raw_input().split())) +n, m = list(map(int,input().split())) g = [[] for i in range(n)] #graph r = [[] for i in range(n)] #reversed graph # input graph data (edges) for i in range(m): - u, v = list(map(int,raw_input().split())) + u, v = list(map(int,input().split())) g[u].append(v) r[v].append(u) diff --git a/Graphs/tarjans_scc.py b/graphs/tarjans_scc.py similarity index 100% rename from Graphs/tarjans_scc.py rename to graphs/tarjans_scc.py diff --git a/linear-algebra-python/README.md b/linear_algebra_python/README.md similarity index 100% rename from linear-algebra-python/README.md rename to linear_algebra_python/README.md diff --git a/linear-algebra-python/src/lib.py b/linear_algebra_python/src/lib.py similarity index 100% rename from linear-algebra-python/src/lib.py rename to linear_algebra_python/src/lib.py diff --git a/linear-algebra-python/src/tests.py b/linear_algebra_python/src/tests.py similarity index 100% rename from linear-algebra-python/src/tests.py rename to linear_algebra_python/src/tests.py diff --git a/machine_learning/perceptron.py b/machine_learning/perceptron.py index 86556f2e5..fe1032aff 100644 --- a/machine_learning/perceptron.py +++ b/machine_learning/perceptron.py @@ -120,5 +120,5 @@ network.trannig() while True: sample = [] for i in range(3): - sample.insert(i, float(raw_input('value: '))) - network.sort(sample) \ No newline at end of file + sample.insert(i, float(input('value: '))) + network.sort(sample) diff --git a/machine_learning/Reuters - OneVsRestClassifier.ipynb b/machine_learning/reuters_one_vs_rest_classifier.ipynb similarity index 100% rename from machine_learning/Reuters - OneVsRestClassifier.ipynb rename to machine_learning/reuters_one_vs_rest_classifier.ipynb diff --git a/Maths/PrimeCheck.py b/maths/PrimeCheck.py similarity index 100% rename from Maths/PrimeCheck.py rename to maths/PrimeCheck.py diff --git a/Maths/BasicMaths.py b/maths/basic_maths.py similarity index 100% rename from Maths/BasicMaths.py rename to maths/basic_maths.py diff --git a/Maths/FibonacciSequenceRecursion.py b/maths/fibonacci_sequence_recursion.py similarity index 100% rename from Maths/FibonacciSequenceRecursion.py rename to maths/fibonacci_sequence_recursion.py diff --git a/Maths/GreaterCommonDivisor.py b/maths/greater_common_divisor.py similarity index 100% rename from Maths/GreaterCommonDivisor.py rename to maths/greater_common_divisor.py diff --git a/Maths/ModularExponential.py b/maths/modular_exponential.py similarity index 100% rename from Maths/ModularExponential.py rename to maths/modular_exponential.py diff --git a/Maths/SegmentedSieve.py b/maths/segmented_sieve.py similarity index 100% rename from Maths/SegmentedSieve.py rename to maths/segmented_sieve.py diff --git a/Maths/SieveOfEratosthenes.py b/maths/sieve_of_eratosthenes.py similarity index 87% rename from Maths/SieveOfEratosthenes.py rename to maths/sieve_of_eratosthenes.py index 2b132405a..26c17fa6f 100644 --- a/Maths/SieveOfEratosthenes.py +++ b/maths/sieve_of_eratosthenes.py @@ -1,5 +1,5 @@ import math -n = int(raw_input("Enter n: ")) +n = int(input("Enter n: ")) def sieve(n): l = [True] * (n+1) @@ -21,4 +21,4 @@ def sieve(n): return prime print(sieve(n)) - \ No newline at end of file + diff --git a/Maths/SimpsonRule.py b/maths/simpson_rule.py similarity index 100% rename from Maths/SimpsonRule.py rename to maths/simpson_rule.py diff --git a/Maths/TrapezoidalRule.py b/maths/trapezoidal_rule.py similarity index 100% rename from Maths/TrapezoidalRule.py rename to maths/trapezoidal_rule.py diff --git a/networking_flow/Ford_Fulkerson.py b/networking_flow/ford_fulkerson.py similarity index 100% rename from networking_flow/Ford_Fulkerson.py rename to networking_flow/ford_fulkerson.py diff --git a/networking_flow/Minimum_cut.py b/networking_flow/minimum_cut.py similarity index 100% rename from networking_flow/Minimum_cut.py rename to networking_flow/minimum_cut.py diff --git a/Neural_Network/bpnn.py b/neural_network/bpnn.py similarity index 100% rename from Neural_Network/bpnn.py rename to neural_network/bpnn.py diff --git a/Neural_Network/convolution_neural_network.py b/neural_network/convolution_neural_network.py similarity index 100% rename from Neural_Network/convolution_neural_network.py rename to neural_network/convolution_neural_network.py diff --git a/Neural_Network/FCN.ipynb b/neural_network/fcn.ipynb similarity index 100% rename from Neural_Network/FCN.ipynb rename to neural_network/fcn.ipynb diff --git a/Neural_Network/perceptron.py b/neural_network/perceptron.py similarity index 98% rename from Neural_Network/perceptron.py rename to neural_network/perceptron.py index 16e632f8d..44c98e29c 100644 --- a/Neural_Network/perceptron.py +++ b/neural_network/perceptron.py @@ -120,5 +120,5 @@ network.trannig() while True: sample = [] for i in range(3): - sample.insert(i, float(raw_input('value: '))) + sample.insert(i, float(input('value: '))) network.sort(sample) diff --git a/other/Dictionary.txt b/other/dictionary.txt similarity index 100% rename from other/Dictionary.txt rename to other/dictionary.txt diff --git a/other/FindingPrimes.py b/other/findingPrimes.py similarity index 100% rename from other/FindingPrimes.py rename to other/findingPrimes.py diff --git a/other/Fischer-Yates_Shuffle.py b/other/fischer_yates_shuffle.py similarity index 100% rename from other/Fischer-Yates_Shuffle.py rename to other/fischer_yates_shuffle.py diff --git a/other/LinearCongruentialGenerator.py b/other/linear_congruential_generator.py similarity index 100% rename from other/LinearCongruentialGenerator.py rename to other/linear_congruential_generator.py diff --git a/other/nested_brackets.py b/other/nested_brackets.py index 17ca01161..76677d564 100644 --- a/other/nested_brackets.py +++ b/other/nested_brackets.py @@ -37,7 +37,7 @@ def is_balanced(S): def main(): - S = raw_input("Enter sequence of brackets: ") + S = input("Enter sequence of brackets: ") if is_balanced(S): print((S, "is balanced")) diff --git a/other/tower_of_hanoi.py b/other/tower_of_hanoi.py index 92c331564..dc15b2ce8 100644 --- a/other/tower_of_hanoi.py +++ b/other/tower_of_hanoi.py @@ -19,7 +19,7 @@ def moveDisk(fp,tp): print(('moving disk from', fp, 'to', tp)) def main(): - height = int(raw_input('Height of hanoi: ')) + height = int(input('Height of hanoi: ')) moveTower(height, 'A', 'B', 'C') if __name__ == '__main__': diff --git a/other/two-sum.py b/other/two_sum.py similarity index 100% rename from other/two-sum.py rename to other/two_sum.py diff --git a/Project Euler/Problem 31/sol1.py b/project_euler/Problem 31/sol1.py similarity index 100% rename from Project Euler/Problem 31/sol1.py rename to project_euler/Problem 31/sol1.py diff --git a/Project Euler/README.md b/project_euler/README.md similarity index 100% rename from Project Euler/README.md rename to project_euler/README.md diff --git a/Project Euler/Problem 01/sol1.py b/project_euler/problem_01/sol1.py similarity index 100% rename from Project Euler/Problem 01/sol1.py rename to project_euler/problem_01/sol1.py diff --git a/Project Euler/Problem 01/sol2.py b/project_euler/problem_01/sol2.py similarity index 100% rename from Project Euler/Problem 01/sol2.py rename to project_euler/problem_01/sol2.py diff --git a/Project Euler/Problem 01/sol3.py b/project_euler/problem_01/sol3.py similarity index 100% rename from Project Euler/Problem 01/sol3.py rename to project_euler/problem_01/sol3.py diff --git a/Project Euler/Problem 01/sol4.py b/project_euler/problem_01/sol4.py similarity index 100% rename from Project Euler/Problem 01/sol4.py rename to project_euler/problem_01/sol4.py diff --git a/Project Euler/Problem 02/sol1.py b/project_euler/problem_02/sol1.py similarity index 100% rename from Project Euler/Problem 02/sol1.py rename to project_euler/problem_02/sol1.py diff --git a/Project Euler/Problem 02/sol2.py b/project_euler/problem_02/sol2.py similarity index 100% rename from Project Euler/Problem 02/sol2.py rename to project_euler/problem_02/sol2.py diff --git a/Project Euler/Problem 02/sol3.py b/project_euler/problem_02/sol3.py similarity index 95% rename from Project Euler/Problem 02/sol3.py rename to project_euler/problem_02/sol3.py index ede5e196b..d36b741bb 100644 --- a/Project Euler/Problem 02/sol3.py +++ b/project_euler/problem_02/sol3.py @@ -7,7 +7,7 @@ By considering the terms in the Fibonacci sequence whose values do not exceed n, e.g. for n=10, we have {2,8}, sum is 10. ''' """Python 3""" -n = int(raw_input()) +n = int(input()) a=0 b=2 count=0 diff --git a/Project Euler/Problem 03/sol1.py b/project_euler/problem_03/sol1.py similarity index 97% rename from Project Euler/Problem 03/sol1.py rename to project_euler/problem_03/sol1.py index 72aed48b8..bb9f8ca9a 100644 --- a/Project Euler/Problem 03/sol1.py +++ b/project_euler/problem_03/sol1.py @@ -19,7 +19,7 @@ def isprime(no): return True maxNumber = 0 -n=int(raw_input()) +n=int(input()) if(isprime(n)): print(n) else: diff --git a/Project Euler/Problem 03/sol2.py b/project_euler/problem_03/sol2.py similarity index 75% rename from Project Euler/Problem 03/sol2.py rename to project_euler/problem_03/sol2.py index 91503cc2d..cbef08e26 100644 --- a/Project Euler/Problem 03/sol2.py +++ b/project_euler/problem_03/sol2.py @@ -5,12 +5,7 @@ e.g. for 10, largest prime factor = 5. For 17, largest prime factor = 17. ''' from __future__ import print_function -try: - raw_input # Python 2 -except NameError: - raw_input = input # Python 3 - -n=int(raw_input()) +n=int(input()) prime=1 i=2 while(i*i<=n): diff --git a/Project Euler/Problem 04/sol1.py b/project_euler/problem_04/sol1.py similarity index 93% rename from Project Euler/Problem 04/sol1.py rename to project_euler/problem_04/sol1.py index 27490130c..05fdd9eba 100644 --- a/Project Euler/Problem 04/sol1.py +++ b/project_euler/problem_04/sol1.py @@ -4,7 +4,7 @@ A palindromic number reads the same both ways. The largest palindrome made from Find the largest palindrome made from the product of two 3-digit numbers which is less than N. ''' from __future__ import print_function -limit = int(raw_input("limit? ")) +limit = int(input("limit? ")) # fetchs the next number for number in range(limit-1,10000,-1): @@ -26,4 +26,4 @@ for number in range(limit-1,10000,-1): print(number) exit(0) - divisor -=1 \ No newline at end of file + divisor -=1 diff --git a/Project Euler/Problem 04/sol2.py b/project_euler/problem_04/sol2.py similarity index 93% rename from Project Euler/Problem 04/sol2.py rename to project_euler/problem_04/sol2.py index a7e486d38..68284ed34 100644 --- a/Project Euler/Problem 04/sol2.py +++ b/project_euler/problem_04/sol2.py @@ -12,8 +12,8 @@ for i in range(999,100,-1): arr.append(i*j) arr.sort() -n=int(raw_input()) +n=int(input()) for i in arr[::-1]: if(i