user2829162
user2829162

Reputation: 1

'Can't assign to operator' syntax error, Python

import math


def main():  
    loop=eval(input("How many times do you want to run the loop?" ))  
    x=eval(input("What number are you taking the square root of? "))  
    for i in range(loop):  
        x=guess  
        x/2=(guess+(x/guess))/2  
    print(guess)  

main()

Upvotes: 0

Views: 645

Answers (1)

falsetru
falsetru

Reputation: 369134

Following line cause a syntax error:

x/2=(guess+(x/guess))/2 

Maybe typo of the following?

x = (guess+(x/guess))/2 

Upvotes: 1

Related Questions