EOF problem with ENTER
Jean-Michel Pichavant
jeanmichel at sequans.com
Fri Jun 12 08:39:04 EDT 2009
Prasoon wrote:
> I modified my code to
>
> #Euler Totient Function
> import sys
> 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():
> while True:
> t=raw_input()
> if t!="":break
> t=int(t)
> while(t):
> while True:
> x=raw_input()
> if x!="":break
> x=int(x)
> print str(etf(x))
> t-=1
>
> if __name__ == "__main__":
> main()
>
> Now it is working fine ....thanks!!!
>
Hello Prasoon, there's still a major issue with your code, check out
http://tottinge.blogsome.com/meaningfulnames/
If your code is a private script targeted at your personal use, well I
guess you can just ignore my comment. But I'm still impressed by how
some of the python-list users have dived into your code with such ease.
Regards,
Jean-Michel
More information about the Python-list
mailing list