My issue
My code
# cook your dish here
for i in range(int(input())):
no_digits=int(input())
if no_digits==1:
print("3")
else:
st="3"*(no_digits-1)
i=int(st)
print(3*i+6)
Learning course: Jump from 2* to 3*
Problem Link: Make it Divisible Practice Problem in Jump from 2* to 3* - CodeChef
@mjarunshowry
the correct logic would be print n-1 times 9 and one time 3
What’s wrong with my code
Can u help me with a test case?
Your code is theoretically ok, but there’s a reason behind why this apparently easy problem is a "Jump from 2* to 3* "
I’ll give you a hint:
For many languages (0.1 + 0.2) doesn’t equal to 0.3
The reason behind also applies to large numbers in Python.
This approach wouldn’t even work in C or C++
@mjarunshowry
for n=10^4 it won’t work.