# Display the matrix in snake order r=int(input("enter the number of row")) c=int(input("enter number of column")) matrix = [] for i in range(r): a=[] for j in range(0,c): a.append(int(input())) matrix.append(a) # print matrix for i in range(r): for j in range(c): print(matrix[i][j],end=" ") print() print("In snake order") #print in snake pattern for i in range(r): if i == 0 or i %2== 0: for j in range(0,c): print(matrix[i][j], end= " ") if i % 2 !=0: for j in reversed(range(c)): print(matrix[i][j], end=" ") print() Same code in python.
import numpy as np n=int(input()) l=[ ] for i in range(n): for j in range(n): l.append(int(input())) a=np.asarray(l) a=np.reshape(a,(n,n)) for i in range(n): for j in range(n): if i%2==0: print(a[i][j],end=" ") else: print(a[i][-j-1],end=" ") it will be easy in python
Hii As per the code it is first taking the 1 test case matrix as input and then printing the snake pattern of first test case matrix elements then taking the 2 nd test case matrix as input and printing the snake pattern of 2nd test case matrix elements Could you please let us know how to print snake pattern matrixes elements of one after the other i.e test case 1 and test case 2 matrix elements
l=int(input()) a=[int(x) for x in input().split()] a=np.array(a).reshape(l,l) c=False for i in a: if c==False: for j in i: print(j,end=' ') c=not c else: for j in reversed(i): print(j,end=' ') c=not c print() #MUCH EASIER IN PYTHON
for _ in range(int(input())): n = int(input()) arr = [int(x) for x in input().split()] ans = [] j=0 for i in range(n): temp = arr[j:n+j] ans.append(temp) j+=n for i,j in enumerate(ans): if(i&1): j = j[::-1] print(' '.join([str(i) for i in j]),end = ' ') else: print(' '.join([str(i) for i in j]),end = ' ') print()
@@vikas2435 tcs ek exam conduct krata hai codevita ke naam se 2021 me phir hoga tb apply kr dena ...tcs ka next step kr ke website hai vha jaa ke register kr lo..
Sir please make such video for Coding section of TCS Digital.
sir please make few videos for cracking the tcs nqt coding section...this would be so helpful for us
Very good explanation sir.Thank u onlinestudy4u for helping the students in the preparation
prem kumar Yes Sir
Hey can you upload the videos for company's for ECE where it has less of coding and more of the core
The snake pattern question was so easy for a beginner
# Display the matrix in snake order
r=int(input("enter the number of row"))
c=int(input("enter number of column"))
matrix = []
for i in range(r):
a=[]
for j in range(0,c):
a.append(int(input()))
matrix.append(a)
# print matrix
for i in range(r):
for j in range(c):
print(matrix[i][j],end=" ")
print()
print("In snake order")
#print in snake pattern
for i in range(r):
if i == 0 or i %2== 0:
for j in range(0,c):
print(matrix[i][j], end= " ")
if i % 2 !=0:
for j in reversed(range(c)):
print(matrix[i][j], end=" ")
print()
Same code in python.
U r the best sir
+1
Thank for this video 🙏
Please make more videos for these kind of questions.
import numpy as np
n=int(input())
l=[ ]
for i in range(n):
for j in range(n):
l.append(int(input()))
a=np.asarray(l)
a=np.reshape(a,(n,n))
for i in range(n):
for j in range(n):
if i%2==0:
print(a[i][j],end=" ")
else:
print(a[i][-j-1],end=" ")
it will be easy in python
This is more easy
Sir please make some videos for the ECE branch ..... With some information of Core companies
Sir plzzz make more videos🙏🙏 of TCS digital
Please make more videos on this 🙏
Hii
As per the code it is first taking the 1 test case matrix as input and then printing the snake pattern of first test case matrix elements then taking the 2 nd test case matrix as input and printing the snake pattern of 2nd test case matrix elements
Could you please let us know how to print snake pattern matrixes elements of one after the other i.e test case 1 and test case 2 matrix elements
Exactly that is what the question asked for.
yeah,i too thinking the same
Sir please make more only 15days are left
Could we use C++ STL in TCS Digital coding question
Hello sir, can u make a video on accenture hiring process for 2021 batch?
Python tutorial also..for digital preparation
After compile program direct final submit or not?
sir pls give me which app is better to preparing coding questiones
Love you sirji
is the pattern same for mba students please reply
Is it true that the python compiler doesn't work properly?
yeah same doubt
@@KASIDIABHILASH yes, usme kbhi kbhi library incude nhi hogi jo tum use kr rhe hinge. its better to use c or cpp
2020batch is eligible
Bro In my Digital exam yesterday I was written two codes and executed but I am not done final submit. Is codes are auto submitted or not 🥲
Plz do in python
Hello sir, bug fan I am
Sir , tell how to take input one after other
Sir , GeeksforGeeks compiler is one of the worst. Try using any another compiler
How can we apply/register for tcs digital exam
You can't apply directly.
You should crack either NQT or Codevita
Application link plz ??
Wht is the software that is used for pen?
Epic Pen
BCA graduates are eligible for this job???
Int arr[N][N] is showing constant value require error.
Yes, it will give error if you are using turbo c.
Can you show solutions in Python also ?
l=int(input())
a=[int(x) for x in input().split()]
a=np.array(a).reshape(l,l)
c=False
for i in a:
if c==False:
for j in i:
print(j,end=' ')
c=not c
else:
for j in reversed(i):
print(j,end=' ')
c=not c
print()
#MUCH EASIER IN PYTHON
for _ in range(int(input())):
n = int(input())
arr = [int(x) for x in input().split()]
ans = []
j=0
for i in range(n):
temp = arr[j:n+j]
ans.append(temp)
j+=n
for i,j in enumerate(ans):
if(i&1):
j = j[::-1]
print(' '.join([str(i) for i in j]),end = ' ')
else:
print(' '.join([str(i) for i in j]),end = ' ')
print()
Akshat Saxena Thanks :)
Yash Dhiman Thanks :)
When I'm having the exam in November I got exception call nosuchelement scanner exception I don't know why I'm declared scanner class also
Did you forgot to import "util.Scanner" ??
@@sukhendrasingh207 bro I'm imported that too
The second T loop doesn't wrks
Do as many questions as possible
Will 2020 pass out eligible for nqt
Plz reply 😭😭
yes .. wait codevita next season and apply .. that time you should prepare for this..
Kya Bhai samaj nahe aya
@@vikas2435 tcs ek exam conduct krata hai codevita ke naam se 2021 me phir hoga tb apply kr dena ...tcs ka next step kr ke website hai vha jaa ke register kr lo..
@@neerajyadav9412 no in codevita 2020 only 21 passouts were eligible and in codevita 2021 only 22 passouts will be eligible
I think coding part is just like open book exam... is it???
sir is prepinsta is good to take for campus placements
th-cam.com/video/MYtQ3M0rJZQ/w-d-xo.html
@@OnlineStudy4u tq
@@OnlineStudy4u sir Then which one is best for campus placement
@@S-S445 onlinestudy4u is the best for campus placement
@@OnlineStudy4u yeah sir tq I asked because my friend suggested me. Tq
When tcs digital exam results are declared?