Python program to count total number of vowel,consonant,lowercase,uppercase

Image
Q)Python program to count total no vowel,consonant,lowercase,uppercase. Ans: def ayush(str):     vowels = 0     consonant = 0     lower = 0     upper= 0     for i in range(0, len(str)):          ch = str[i]          if ch.isupper():         upper+=1         elif ch.islower():         lower+=1         if ( (ch >= 'a' and ch <= 'z') or (ch >= 'A' and ch <= 'Z') ):          ch = ch.lower()         if (ch == 'a' or ch == 'e' or ch == 'i' or ch == 'o' or ch == 'u'):         vowels += 1         else:         consonant += 1         else:         pass     print("Vowels:", vowels)     print("Consonant:", consonant)     print("lowercase:", lower)     print("uppercase:", upper)  str=input('enter the string:') ayush(str) Output:

program for Max of three number in Python

1)Write a python program to find Max of three number ?
Ans:   
  
def max_of_3_num(a,b,c):
    if a>b and a>c:
        return 'Max of three num is', a
    elif b>a and b>c:
        return 'Max of three num is', b
    else:
        return 'Max of three num is', c
a=int(input("Enter the first num :"))
b=int(input("Enter the second num :"))
c=int(input("Enter the third num :"))
print(max_of_3_num(a,b,c))

                                                        Or


a=int(input("Enter the first num :"))
b=int(input("Enter the second num :"))
c=int(input("Enter the third num :"))
if a>b and a>c:
    print('Max of three num is', a)
elif b>a and b>c:
    print('Max of three num is', b)
else:
    print('Max of three num is', c)








Thanks for visiting this site


Comments

Popular posts from this blog

Python Program to rotate the screen of your PC

Python program to reverse a string

Python program to read a text file and display a no of vowels, consonant, uppercase, lowercase character in file