Xi Program List Term 1
Xi Program List Term 1
SCHOOL VELLORE
PROGRAM:
large=n1
if(large<n2):
large=n2
if(large<n3):
large = n3
OUTPUT
2. Write a program to enter any number and check it is even or odd
Aim: python program to enter any number and check it is even or Odd
PROGRAM:
if num%2==0:
else:
OUTPUT:
3. A Python program to input temperature of water and print its physical statement
Aim: Python program to input temperature of water and print its physical statement
PROGRAM:
if temp>100:
print("Gaseous State:")
elif temp<=0:
print("Solid State")
else:
print("Liquid State")
OUTPUT:
\
4. USING ARITHMETIC OPERATORS:
PROGRAM:
add=num1+num2
sub=num1-num2
multi=num1*num2
div=num1/num2
rem=num1%num2
exp=num1**num2
flo=num1//num2
print("addition:",add)
print("subtraction:",sub)
print("Multiplication:",multi)
print("Division:",div)
print("Remainder:",rem)
print("exponent:",exp)
print("Floor division:",flo)
OUTPUT:
5. Write a Python Program to calculate the Simple Interest
PROGRAM:
si= (p*n*r)/100
OUTPUT:
6. Input a number and check if the number it is a prime number or not(composite
number):
AIM: Input a number and check if the number it is a prime number or not(composite
number)
PROGRAM:
lim=num//2+1
for i in range(2,lim):
rem=num%i
if rem==0:
break
else:
PROGRAM: (3.A)
for i in range(1,10):
for j in range(1,i+1):
print(j,end='')
print()
PROGRAM(3.B)
for i in range(1,10):
for j in range(1,i+1):
print('*',end='')
print()
PROGRAM:(3.C)
for i in range(9,0,-1):
for j in range(i,0,-1):
print(j,end='')
print()
OUTPUT: (3.A)
OUTPUT (3.B)
OUTPUT: (3.C)
8.To write a python program to check whether the given number is perfect or not.
Aim: A python program to check whether the given number is perfect or not.
PROGRAM:
sum=0
for i in range(1,n):
if n%i==0:
sum=sum+i
if sum==n:
else:
OUTPUT
9.WAP to An Armstrong number has sum of the cubes of the digits is equal to the
number itself
Aim: An Armstrong number has sum of the cubes of the digits is equal to the number
itself.
PROGRAM:
no1=no
sum=0
while(no>0):
ans=no%10
sum=sum+(ans*ans*ans)
no=int(no/10)
if sum==no1:
print("Armstrong number!")
else:
OUTPUT:
10.To write a python program to find the factorial of the given number.(for ..Loop,While
loop)
AIM: Python program to find the factorial of given number using (for.. Loop and While
loop.
PROGRAM:
fact=1
for i in range(1,num+1):
fact=fact*i
PROGRAM:
fact=1
i=1
while i<=num:
fact=fact*i
i=i+1
Aim:
python program to prepare the student marklist . Enter the student name, roll no and all
subjects marks to calculate total ,avg and grade
PROGRAM:
total= eng+phy+che+mat+csc
avg=total/5
print()
print("Name:",name)
print("Roll No:",rollno)
print("English:",eng)
print("Physics:",phy)
print("Chemistry:",che)
print("Maths:",mat)
print("Computer Science:",name)
print("Total:",total)
print("Average:",avg)
if avg>=60:
elif avg>=45:
elif avg>=33:
else:
print("Result: FAIL")
OUTPUT:
12.To write a python program to print the Fibonacci series for the given number of
terms.
AIM: a python program to print the Fibonacci series for the given number of
terms.
PROGRAM:
x=0
y=1
z=1
print(x,y,end=" ")
while(z<=i):
print(z,end=" ")
x=y
y=z
z=x+y
OUTPUT:
13.To write a python program to check whether the given string is palindrome or not.
AIM: A python program to check whether the given string is palindrome or not
PROGRAM:
def isPanlindrome(s):
return s==s[::-1]
ans=isPanlindrome(s)
if ans:
else:
OUTPUT:
14. WAP TO CHECK ENTERED YEAR IS LEAP YEAR OR NOT
PROGRAM:
if year%100==0:
if year%400==0:
else:
elif year%4==0:
else:
OUTPUT:
15. WAP that counts the number of alphabets and digits, uppercase letters, lowercase letter, spaces and
other characters in the string entered
AIM: counts the number of alphabets and digits, uppercase letters, lowercase letter, spaces and other
characters in the string entered
PROGRAM:
str1=input("Enter a String:")
N=C=D=S=U=L=OT=0
for ch in str1:
if ch.isalnum():
N+=1
if ch.isupper():
U+=1
elif ch.islower():
L+=1
elif ch.isalpha():
C+=1
if ch.isdigit():
D+=1
elif ch.isspace():
S+=1
else:
OT+=1
print("No of Digits",D)
print("No of Spaces",S)