0

On Submission Wrong Answer ? What is wrong with my code?

this is my coding question ``` https://www.codechef.com/problems/CIELRCPT ``` this is my code ``` try: for i in range(int(input())): p = int(input()) n = p menu = 0 rem = 0 stri = '' while n > 0: rem = n % 2 stri = stri + str(rem) n = n - rem n = n // 2 stri = stri[::-1] if p in range(1,2049): for j in stri: menu += int(j) print(menu) else: for j in stri: menu += int(j) if menu == 1: print(p//2048) else: print(menu) except: pass ```

2nd Jul 2021, 10:00 AM
Parth Lashkari
Parth Lashkari - avatar
2 Réponses
+ 1
I could be wrong but I believe It may detect a syntax error or two somewhere around the stri = " line.
10th Jul 2021, 9:39 PM
noah hulvey
0
I dont see anything wrong. If i put sample inputs. Output Is same as sample Output. What error do you get?
8th Jul 2021, 1:00 PM
Jimmy Phoitick
Jimmy Phoitick - avatar