Professional Documents
Culture Documents
Xi CSC - Practicals Program 2022-2023
Xi CSC - Practicals Program 2022-2023
Program that takes a number and checks whether the given number
is odd or even
num=int(input("Enter an integer - "))
if num%2==0:
print(num,"is even")
else:
print(num,"is odd")
Enter an integer: 5
5 is odd
3. Program to accept three integers and print the largest of the three.
a=float(input("Enter first number"))
b=float(input("Enter second number"))
c=float(input("Enter third number"))
if a==b==c:
print("All numbers are equal")
elif b<a>c: a>b and a>c
print(a,"is the largest")
elif a<b>c:
Enter first number56
print(b,"is the largest")
Enter second number89
else: Enter third number32
print(c,"is the largest") 89 is the largest
4. Program to accept three integers and prints them in ascending order
10. Program to read a line and display the number of uppercase letters,
lowercase letters, alphabets and digits.
s=input("Enter a string-")
up=lo=al=di=0
for i in s: Enter a string-RiYaDh2020
if i.isupper(): Uppercase Letters is 3
up+=1 Lowercase Letters is 3
if i.islower(): Number of Alphabets is 6
lo+=1 Number of digits 4
if i.isalpha():
al+=1
if i.isdigit():
di+=1
print("Uppercase Letters is",up)
print("Lowercase Letters is",lo)
print("Number of Alphabets is",al)
print("Number of digits",di)
11. Write a program in Python to find the average or mean of a given list
of elements.