Friday, February 5, 2021

Python program for finding unique characters from the string

 temp = ""

string = input("Enter a string:")

for ch in string:

    nch = ch

    if(nch in temp):

        pass

    else:

        print(ch)

    temp = temp + ch






temp = ""

string = input("Enter a string:")

for ch in string:

    nch = ch

    count = 1

    if(nch in temp):

        count += 1

    else:

        print(ch,"count:", count)

    temp = temp + ch

Python program for reversing a string

First Method:


string = input("Enter a string:")

r = ""

l = len(string)

for a in range(l):

    r = r + string[l-a-1]

if(string == r):

    print(string, "is a palindrome")

else:

    print(string, "is not a palindrome")


Second Method: 


string = input("Enter a string:")

r = ""

length = len(string)

for a in range(-1, (-length-1), -1):

    r = r + string[a]

if(string == r):

    print(string, "is a palindrome")

else:

    print(string, "is not a palindrome")



Tuesday, February 2, 2021

Python program for String Traversal

 name = "awesome"

for c in name:

    print(c,'-', end = ' ')


Python program for reading a string and displaying it in reverse order

 string = input("Enter a string:")

print("The", string, "in reverse order is:")

length = len(string)

for l in range(-1, (-length-1), -1):

print(string[l])

How to Fight Overthinking or Negative Thoughts?

How to Combat Overthinking or Negative Thoughts? 1. Don’t Fight Your Thoughts Trying to suppress or control negative thoughts often backfire...