Re: EOF problem with ENTER

2009-06-12 Thread Jean-Michel Pichavant
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 Tr

Re: EOF problem with ENTER

2009-06-12 Thread Prasoon
> You could do: > > while True: >    x = raw_input("Enter x=>") >    if x != "" : break # if you just press enter, raw_input returns an > empty string > > Note that this still leaves out the case when you type something which > is not a number. > To cover this case, supposing that you need a float

Re: EOF problem with ENTER

2009-06-12 Thread Francesco Bochicchio
On 12 Giu, 08:49, Prasoon wrote: > On Jun 12, 11:28 am, Chris Rebert wrote: > > > > > > > On Thu, Jun 11, 2009 at 11:17 PM, Prasoon wrote: > > > I am new to python > > > I have written the following program in python.It is the solution of > > > problem ETF in SPOJ. > > > > #Euler Totient

Re: EOF problem with ENTER

2009-06-11 Thread Prasoon
On Jun 12, 11:28 am, Chris Rebert wrote: > On Thu, Jun 11, 2009 at 11:17 PM, Prasoon wrote: > > 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): > >

Re: EOF problem with ENTER

2009-06-11 Thread Prasoon
On Jun 12, 11:28 am, Chris Rebert wrote: > On Thu, Jun 11, 2009 at 11:17 PM, Prasoon wrote: > > 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): > >

Re: EOF problem with ENTER

2009-06-11 Thread Chris Rebert
On Thu, Jun 11, 2009 at 11:17 PM, Prasoon wrote: > 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): >  

EOF problem with ENTER

2009-06-11 Thread 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