0% found this document useful (0 votes)
26 views2 pages

Class XII Computer Science Practicals

The document contains practical exercises for Class XII Computer Science, focusing on string manipulation in Python. It includes three practicals: counting vowels in a string, counting words that start with a vowel, and categorizing characters in a string into lowercase, uppercase, digits, and special characters. Each practical provides a code snippet to achieve the desired functionality.

Uploaded by

bhingaredigvijay
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views2 pages

Class XII Computer Science Practicals

The document contains practical exercises for Class XII Computer Science, focusing on string manipulation in Python. It includes three practicals: counting vowels in a string, counting words that start with a vowel, and categorizing characters in a string into lowercase, uppercase, digits, and special characters. Each practical provides a code snippet to achieve the desired functionality.

Uploaded by

bhingaredigvijay
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Class XII Computer Science Practical File

PRACTICAL 1: Number of vowels in a given string

str1 = input("Enter the line: ")

count = 0

for i in str1:

if i in 'aeiouAEIOU':

count += 1

print("Number of vowels:", count)

PRACTICAL 2: Words starting with a vowel

str1 = input("Enter the line: ")

count = 0

words = [Link]()

for i in words:

if i[0] in 'aeiouAEIOU':

count += 1

print("Number of words starting with vowel:", count)

PRACTICAL 3: Uppercase, lowercase, digits

line = input("Enter the value: ")

lcount = ucount = dcount = schar = 0

for i in line:

if [Link]():

lcount += 1
elif [Link]():

ucount += 1

elif [Link]():

dcount += 1

else:

schar += 1

print("Alphabets:", lcount + ucount)

print("Lowercase:", lcount)

print("Uppercase:", ucount)

print("Digits:", dcount)

print("Special characters:", schar)

You might also like