Python program to check whether a string is a palindrome or not
string=input("Please enter a string: ")
if(string==string):
print("Given string is palindrome")
else:
print("Given string is not palindrome")
...
Python program to count the number of vowels in a string
string=input("Please enter string: ")
vowels=0
for i in string:
if(i=='a' or i=='e' or i=='i' or i=='o' or i=='u' or i=='A' or i=='E' or =='I' or i=='O'...
Python program reads a line prints its statistics
line=input("Please enter a line: ")
lowercount=uppercount=0
digitcount=alphacount=0
for a in line:
if a.islower():
lowercount+=1
...
Python program to print the following pattern without using any nested loop
string='#'
pattern="" # Empty String
for a in range (7):
pattern+=string
print(pattern)
Output:
...
Python program to read a string and display it in reverse order
str=input("Please Enter a string: ")
print("The",str, "in reverse order is:")
length=len(str)
for a in range(-1,(-length-1),-1):
print(str)
Output:
...