EOF while parsing

Discussion in 'Python' started by prasoon, Jun 11, 2009.

  1. prasoon

    prasoon

    Joined:
    Jun 11, 2009
    Messages:
    3
    I am new to python..I have written a code for the problem ETF in SPOJ in python but getting run time error

    #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():
    t=input()
    while(t):
    x=input()
    print str(etf(x))
    t-=1

    if __name__ == "__main__":
    main()

    While running the program if I press an enter key i get an error

    SyntaxError: unexpected EOF while parsing


    What should be the modification in my code for the program to work correctly
     
    prasoon, Jun 11, 2009
    #1
    1. Advertising

  2. prasoon

    prasoon

    Joined:
    Jun 11, 2009
    Messages:
    3
    I want the cursor to move to the next line when enter key is pressed...

    Please help me.....
     
    prasoon, Jun 12, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kobu
    Replies:
    10
    Views:
    630
    Keith Thompson
    Mar 4, 2005
  2. oscartheduck
    Replies:
    7
    Views:
    5,354
    Steve Holden
    Apr 4, 2007
  3. SpreadTooThin

    ifstream eof not reporting eof?

    SpreadTooThin, Jun 13, 2007, in forum: C++
    Replies:
    10
    Views:
    702
    James Kanze
    Jun 15, 2007
  4. ramana
    Replies:
    5
    Views:
    358
    ramana
    Dec 26, 2007
  5. Jan Burse
    Replies:
    67
    Views:
    1,068
    Jan Burse
    Mar 14, 2012
Loading...

Share This Page