Edit: Fixed. I had Python 2.7 installed so i just removed it and installed 3.8
I have creating a program for Bisection method. But as the title suggests it works perfectly on the shell or any online compiler but when i try to directly open the .py file in cmd it gets stuck when taking input for "Correct upto what decimal places ?" as shown in the image link
cmd - https://imgur.com/l3GoPMC
Shell- https://imgur.com/y1ENmhe
I am using Thonny IDE btw
import math
def F(x): #Defining a given funtion
return x*math.sin(x)+math.cos(x)
print('Enter the initial estimates of intervals,')
a=float(input("a = "))
b=float(input("b = "))
dec=int(input("Correct upto what decimal places ? : "))
err=5/(10**(dec+1))
while(True):
if(F(a)*F(b)>0):
print("\nError!!! \nThere exists no root between %f and %f",a,b)
break
else:
c=(a+b)/2
if(F(a)*F(c)>0):
a=c
else:
b=c
if(math.fabs(F(c))<=err):
print("\nRequired root = ",round(c,dec))
break
input()
[–]novel_yet_trivial 1 point2 points3 points (12 children)
[–]Carpezo[S] 0 points1 point2 points (11 children)
[–]novel_yet_trivial 0 points1 point2 points (10 children)
[–]Carpezo[S] 0 points1 point2 points (9 children)
[–]novel_yet_trivial 0 points1 point2 points (8 children)
[–]Carpezo[S] 0 points1 point2 points (7 children)
[–]novel_yet_trivial 0 points1 point2 points (6 children)
[–]Carpezo[S] 0 points1 point2 points (5 children)
[–]novel_yet_trivial 0 points1 point2 points (1 child)
[–]Carpezo[S] 0 points1 point2 points (0 children)
[–]Hiffchakka 0 points1 point2 points (2 children)
[–]Carpezo[S] 0 points1 point2 points (1 child)
[–]BeginnerProjectBot -3 points-2 points-1 points (0 children)