To find the characters at an odd position in string input in Python.

Today, We are going to learn How To find the characters at an odd position in string input given by the user in Python.

we have to make a simple program.

Program:

string = input("Enter the string : ")
string2 = ''
 
for i in range(len(string)):
    if(i % 2 == 0):
        string2 = string2 + string[i]
         
print("user string :  ", string)
print("String with odd character:", string2)

Output:

Enter the string : Hello
user string :   Hello
String with odd character: Hlo

I hope that you found this Blog helpful. If you’ve any queries, please leave comments in the comment section.

Thanks for following and reading this blog.

To find the characters at an odd position in string input in Python.expoundsofttechsolution

To find the characters at an odd position in string input in Python.

Magento 2 checks if the product has a special price