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:

Python Program to rotate the screen of your PC

1) Python program to rotate screen of your PC:
Ans:
'''  first of all u have to install modules like rotatescreen and win32api .  for this , open command prompt and internet should be available and write the command:
        pip install rotatescreen
        pip install win32api   
'''
Now code :-

import rotatescreen
import time
n=int(input("Enter no of time u want to rotate ur screen:"))
a=rotatescreen.get_primary_display()
for i in range(n):
    time.sleep(1)    
    a.rotate_to(i*90 %360)
   
Output
    
>>> U will get the rotatory motion of ur PC screen and in order to stop the execution of program ,u just have to press ctrl+F2. and if Ur screen stops at wrong side then Press shift+f10 to keep it running for few more time(but this time it moves slowly) and when it came to a right direction  press ctrl+F2 .


Thanks for visiting . . . . . . 


Comments

Popular posts from this blog

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