harishsanaka's blog

By harishsanaka, history, 4 years ago, In English

import math def isPrime(n): for i in range(2,int(math.sqrt(n))+1): if(n%i==0): break if(i==int(math.sqrt(n))): return True else: print(i) return False
n1,n2=map(int,input().split()) list1=[] for j in range(n1,n2+1): if(isPrime(j)): list1.append(j) print(list1) _________________________________ i/p: 3 45 Traceback (most recent call last): File "C:\Users\GRIET\AppData\Local\Programs\Python\Python37-32\isPrime.py", line 14, in if(isPrime(j)): File "C:\Users\GRIET\AppData\Local\Programs\Python\Python37-32\isPrime.py", line 6, in isPrime if(i==int(math.sqrt(n))): UnboundLocalError: local variable 'i' referenced before assignment

Full text and comments »

  • Vote: I like it
  • -8
  • Vote: I do not like it

By harishsanaka, history, 4 years ago, In English

I first participated in round #604 solved 0 problem, then my rating was 1371 second #611 solved 1 problem, then my rating became 1248 third #649 solved 0 problem, then my rating became 1134 fourth #650 solved 1 problem, then my rating became 1036

even I solved atleast 1 problem in my fourth contest why my rating falled drastically..?

Full text and comments »

  • Vote: I like it
  • -38
  • Vote: I do not like it