1 / 2
Jun 2012

i am new to python....nd gettings tle in 0 0 Pairs....
plz sm1 help me...

def main():
    pass
if __name__ == '__main__':
    try:
        import psyco
        psyco.full()
    except ImportError:
        pass
    main()
    A=[0,1]
    k=1000
    i=2
    for i in range(2,1000):
        a=(A[i-1])+(2*A[i-2])
        A.append(a)
    try:
        import psyco
        psyco.full()
    except ImportError:
        pass
    while(1):
        try:
             n=int(input())
         print (A[n-1]);
    except:
         break
  • created

    Jun '12
  • last reply

    Jun '12
  • 1

    reply

  • 198

    views

  • 2

    users

  • 1

    link

My advice: Study the official Python tutorial first to learn some basics about how a Python code should look like.
Your code has a very, mmh, "strange" structure.
Then you should perhaps solve some less i/o related problems first and come back to that problem later.

Suggested Topics

Want to read more? Browse other topics in Python or view latest topics.