Sunday, December 13, 2020

The Joy of Computing Using Python December 13 Programming test - Session 1 (10AM to 11AM) Programming Exam 1: Decode the Script Answer

 

Programming Exam 1: Decode the Script

Due on 2020-12-13, 11:00 IST
Nandini has a complex matrix script. The matrix script is a N X M grid of strings. It consists of alphanumeric characters and symbols (!,@,#,$,%,&). To decode the script, Nandini needs to read each column and select only the alphanumeric characters and connect them. She reads the column from top to bottom and starts reading from the leftmost column. If there are symbols in the decoded script, then Nandini removes them for better readability. Alphanumeric characters consist of: [A-Z, a-z, and 0-9].

Input Format

The first line contains space-separated integers N (rows) and M (columns) respectively. 
The next N lines contain the row elements of the matrix script separated by space.

Output Format

Print the decoded matrix script.
Sample Input:
7 3
T s i
h % x
i  # $
s M #
$ a  &
# t %
i r !
Output:
ThisisMatrix


Your last recorded submission was on 2020-12-13, 10:10 IST
Select the Language for this assignment. 
1
a,b=map(int,input().split())
2
l=[]
3
for i in range(a):
4
  x=list(map(str,input().split()))
5
  l.append(x)
6
for i in range(b):
7
  for j in range(a):
8
    if l[j][i].isalnum():
9
      print(l[j][i],end="")

No comments:

Post a Comment