P
Prasoon
I am new to python....
I have written the following program in python.It is the solution of
problem ETF in SPOJ.....
#Euler Totient Function
from math import sqrt
def etf(n):
i,res =2,n
while(i*i<=n):
if(n%i==0):
res-=res/i
while(n%i==0):
n/=i
i+=1
if(n>1):
res-=res/n
return res
def main():
t=input()
while(t):
x=input()
print str(etf(x))
t-=1
if __name__ == "__main__":
main()
The problem with my code is that whenever I press an extra "Enter"
button instead of getting the cursor moved to the next line.....I get
an error
_SyntaxError- EOF while parsing and the program terminates.........._
How should the code be modified so that even after pressing an extra
"Enter" button the cursor get moved to the next line instead to
throwing an exception......
Prasoon
I have written the following program in python.It is the solution of
problem ETF in SPOJ.....
#Euler Totient Function
from math import sqrt
def etf(n):
i,res =2,n
while(i*i<=n):
if(n%i==0):
res-=res/i
while(n%i==0):
n/=i
i+=1
if(n>1):
res-=res/n
return res
def main():
t=input()
while(t):
x=input()
print str(etf(x))
t-=1
if __name__ == "__main__":
main()
The problem with my code is that whenever I press an extra "Enter"
button instead of getting the cursor moved to the next line.....I get
an error
_SyntaxError- EOF while parsing and the program terminates.........._
How should the code be modified so that even after pressing an extra
"Enter" button the cursor get moved to the next line instead to
throwing an exception......
Prasoon