Professor Petr is very angry over some of his students now-a-days for not doing assignment. He wants…
Click here to read the complete problem statement.
If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.
The input can be 1 to 1000. If your code works in that range, your submission will be accepted.
তুমি ২০ পর্যন্ত ইনপুট করে চেক করেছ যে কাজ করছে, যদি জাজ দ্বিতীয় রানিং-এ ২১ দিয়ে চেক করে তোমার প্রোগ্রাম? তখন তো ভুলও দেখাতে পারে, তাই না? কারণ তুমি তো ২১ বা এর পরের কোনো সংখ্যা দিয়ে চেক করোনি। ২১ না শুধু, জাজ ১০০০ এর ভিতর যেকোনো সংখ্যা দিয়েই তোমার প্রোগ্রাম চেক করতে পারে। তাই তোমার প্রোগ্রামকে এমন হতে হবে, যেন ১ থেকে ১০০০ এর মধ্যে যে সংখ্যাই দেয়া হোক না কেন, তোমার প্রোগ্রাম যাতে সঠিক আউটপুট দিতে পারে।
You need to print "I DID NOT DO THE ASSIGNMENT."n number of time. which mean if n is not prime you have to print "I DID NOT DO THE ASSIGNMENT."n number of time.
Try this:
def is_prime(x):
if x == 1:
return False
else:
for i in range(1,int(x**0.5)+1):
if i!=1 and x%i == 0:
return False
return True
n = int(input())
if is_prime(n):
print(‘NO PUNISHMENT’)
else:
for i in range(0,n):
print(‘I DID NOT DO THE ASSIGNMENT.’)
Thank you for your valuable advice. I’ll never do such mistake at all. I have never told anyone any solution even not cleared their doubt or mistake. But suddenly he requested like he was in great trouble, I felt sad cause I have also gone through that hardship and thought he does so. And thus being very emotional, I directly told the solution. But now I’ll clear their doubts and inform their mistakes that they make. And I’ll be grateful to you for your advice. Thank you .