From f75200209e3a7238d124e571e9500f84d3b8c353 Mon Sep 17 00:00:00 2001 From: rwithik Date: Mon, 2 Sep 2019 22:39:08 +0530 Subject: [PATCH] Fixes for Issue #1024 --- graphs/directed_and_undirected_(weighted)_graph.py | 8 ++++---- maths/factorial_python.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/graphs/directed_and_undirected_(weighted)_graph.py b/graphs/directed_and_undirected_(weighted)_graph.py index a31a4a96d6d0..ec86a0708083 100644 --- a/graphs/directed_and_undirected_(weighted)_graph.py +++ b/graphs/directed_and_undirected_(weighted)_graph.py @@ -162,7 +162,7 @@ def cycle_nodes(self): for __ in self.graph[s]: if visited.count(__[1]) > 0 and __[1] != parent and indirect_parents.count(__[1]) > 0 and not on_the_way_back: l = len(stack) - 1 - while True and l >= 0: + while l >= 0: if stack[l] == __[1]: anticipating_nodes.add(__[1]) break @@ -210,7 +210,7 @@ def has_cycle(self): for __ in self.graph[s]: if visited.count(__[1]) > 0 and __[1] != parent and indirect_parents.count(__[1]) > 0 and not on_the_way_back: l = len(stack) - 1 - while True and l >= 0: + while l >= 0: if stack[l] == __[1]: anticipating_nodes.add(__[1]) break @@ -379,7 +379,7 @@ def cycle_nodes(self): for __ in self.graph[s]: if visited.count(__[1]) > 0 and __[1] != parent and indirect_parents.count(__[1]) > 0 and not on_the_way_back: l = len(stack) - 1 - while True and l >= 0: + while l >= 0: if stack[l] == __[1]: anticipating_nodes.add(__[1]) break @@ -427,7 +427,7 @@ def has_cycle(self): for __ in self.graph[s]: if visited.count(__[1]) > 0 and __[1] != parent and indirect_parents.count(__[1]) > 0 and not on_the_way_back: l = len(stack) - 1 - while True and l >= 0: + while l >= 0: if stack[l] == __[1]: anticipating_nodes.add(__[1]) break diff --git a/maths/factorial_python.py b/maths/factorial_python.py index 6c1349fd5f4c..ed08fc3491cb 100644 --- a/maths/factorial_python.py +++ b/maths/factorial_python.py @@ -1,7 +1,7 @@ """Python program to find the factorial of a number provided by the user.""" # change the value for a different result -NUM = 10 +NUM = int(input("Enter the number: ")) # uncomment to take input from the user # num = int(input("Enter a number: "))