diff --git a/README.md b/README.md new file mode 100644 index 0000000..69a1229 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# python-string-operations... +ganesh kavhar python projects.....https://ganeshmkavhar.000webhostapp.com/ + +STRING OPERATIONS:- + +1). COUNT THE FREQUENCY OF EACH WORD IN THE STRING. - charfreqcount.py +2). CONVERT STRING TO BINARY - txtbin.py +3). TO CHECK IF STRING IS PALINDROME - palindrome.py diff --git a/palindrome.py b/palindrome.py new file mode 100644 index 0000000..c988c2b --- /dev/null +++ b/palindrome.py @@ -0,0 +1,32 @@ +def solution(list): + # creating an empty list + lst = [] + + # number of elemetns as input + n = int(input("Enter number of elements : ")) + + # iterating till the range + for i in range(0, n): + ele = int(input()) + + lst.append(ele) # adding the element + + out_list = lst[::-1] #reversing a list + m=0 + + # checking if palindrome + for i in range(0,n): + if lst[i]==out_list[i]: + m=m+1 + else: + print("FALSE") + break + if m==n: + print("TRUE") + + + + + +solution(list) +