B02E-2015D – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  

Login
[lwa]



Exam Questions-CBSE12D-2015-B02E #PYTHON#6530    siteicon   siteicon  

Problem Statement - B02E-2015D

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.

For example, if the content of list is as follows:
ThisList=['41','DROND','GIRIRAJ','13','ZARA']
414141
DROND#
GIRlRAJ#
131313
ZARA#

Solution

TC++ #6530

def fun(L):
    for I in L:
        if I.isnumeric():
            print(3*I) # equivalently: print(I+I+I)
        else:
            print(I+'#')


Share

CSKC| Created: 14-Jan-2019 | Updated: 14-Jan-2019|CBSE12D-2015









Back