Sunday, 23 January 2022

Write a python program to accept string and remove the characters which have odd index values of given string using user defined function.

Slip 15 Q 2

CODE :


def removeodd(string):
    str2=''
    for x in range(len(string)):
        if x%2==0:
            str2=str2+string[x]
    return str2
str1=input('enter a string : ')
print('String after removing char : ',removeodd(str1))


OUTPUT:


No comments:

Post a Comment

Write a Java program to display given extension files from a specific directory on server machine.

 DOWNLOAD     SLIP14Q2 /** * STEPS TO RUN CODE * Step 01 compile the code * Step 02 run the code * Step 03 give a file directory locatio...