Write a method in python to display the elements of list thrice if it is a number and display the element
terminated with '#' if it is not a number.
[CBSE D 2015)
For example, if the content of list is as follows :
List = ['41', 'DROND', 'GIRIRAJ', '13', “ZARA' ]
The output should be
414141
DROND#
GIRIRAJ#
131313
ZARA#
Answers
Answered by
5
Answer:
def fun(L): for I in L: if I.isnumeric(): print(3*I) # equivalently: print(I+I+I) else: print(I+'#')
Similar questions