How ro input test case in python

how ro input test case in python like we do in cpp
int t;cin>>t;while(t–)

Hey @ARYAN27, in python you can do this by :

t= int(input())
while(t>0):
  Rest of the Logic of code 

Hope this helps !
Happy Learning :slight_smile:

while(t>0) this<–

n = int(input()) for _ in range(n):

is this acorrect way

above logic by you is just taking input i want taking n input and decresing as proceed further

Yes that’s also correct. You can write multiple loops with the same logic !

Yeah so you can decrease the value of t inside the loop like this :

t= int(input())
while(t>0):
  Rest of the Logic of code 
  t=t-1

Happy Coding :slight_smile:

def calculate_prime(): st,end=input().split() st=int(st) end=int(end) for n in range(st,end+1): if n>1: for i in range(2,n): if (n%i)==0: break else: print(n,end=" ") n = int(input()) for _ in range(n): calculate_prime() print()

why this showing TLE spaces or somethinfg else is wrong

Hey @ARYAN27, this is a different issue and is not related to test cases input you are taking !
I request you to raise a new doubt for this problem ! I would be happy to help :slight_smile:

Thanks :slight_smile: