J J INTERNATIONAL SCHOOL ,ANAND
REPORT FILE
NAME: DHAN PATEL
STD:11[A] Sci
ROLLNO: 8
SUBJECT: Computer Science
SUBMITTED TO: Mamta Ma,am
[2] Program in python to short three numbers given
by the user
CODE:
a=int(input("enter first number"))
b=int(input("enter second number"))
c=int(input("enter third number"))
if a>b:
if b>c:
print(“number in shorted order:” ,a,” ”,b,’’
”,c)
else:
if c>a:
print(“number in shorted order:” ,c,” ”,a,’’ ”,b)
else:
print(“number in shorted order:” ,a,” ”,c,’’ ”,b)
eilf b>a:
if a>c:
print(“number in short order:” ,b,” ”,a,’’ ”,c)
else:
print(“number in short order:” ,b,” ”,c,’’ ”,a)
else:
print(“number in short order:” ,c,” ”,b,’’ ”,a)
OUTPUT-
[1] Program in python to find the largest number in a list
CODE:
NumList = []
Number = int(input(“enter total number of list”))
for i in range(1, Number + 1):
value = int(input("enter the value of %d element”%i))
NumList.append(value)
print("The Largest Element in this List is : ",
max(NumList))
OUTPUT-
[3] Program in python to remove duplicate of a list
CODE-
Test_list=int(input(“enter the list”))
Test_listn=list()
Print(“the original list is :”+str(Test_list))
Res=[]
For i in Test_list:
if i not I res:
res.append(i)
print(“the list after removing duplicate:”+str(res))
OUTPUT-
[4] Program in python to print inputted number in form of tuple
CODE:
s=tuple()
m=int(input(“enter how many elements you want”))
for i in range(o,m):
num=int(input(“enter number:”))
s=s+(num)
print(“the number in tuple form are: \n” s)
OUTPUT-
[4]Program in python Fibonacci series
CODE:
Num=int(input(“enter the limit of series :”))
X=0
Y=1
Z=0
For i in range(num)
Print(z,end=” ”)
X=y
Y=z
Z=x+y
OUTPUT-
[5] Program in python to print total number of prime numbers
between 2 and inputted number
CODE:
Number=int(input(“prime number between 2 and”,Number))
for num in range(2,number+1):
if num>1:
for i in range (2,num):
if (num % i) ==0:
break
else:
print(num)
OUTPUT-
[6] Program in python to print the factorial of the number
given by user
CODE:
Num=int(input(“enter a number:”))
fact=1
if num <o:
print(“factorial of given number does not exist”)
eilf num ==0:
print(:the factorial of 0 is 1”)
else:
for i in range (1,1+num):
fact=fact*i
print(“factorial of” ,num, “is”,fact)
OUTPUT-
[7] Program in python to calculate temperature scale(Celsius
to fahrenheit)
CODE:
a=float(input(“enter temperature in degree”))
f=a*(8/5)+32
print(“temperature in fahrenhiet”,f)
OUTPUT-
[8] Program in python to give grade according to inputted
percentage
CODE:
P=int(input(“enter your marks perventage”))
if (90<p<100):
print(“your grade is: [A] excellent”)
eilf (80<p<90):
print (“your grade is: [B]very good”)
eilf (70<p<80):
print(“your grade is: [C]good”)
eilf (60<p<70):
print(“your grade is: [D] poor”)
else:
print(“your grade is [E] very poor ”)
OUTPUT-
[9] Program in python to print table of inputted number
CODE:
a=float(input(“enter a number =”))
print(“now its table is below” )
for i in range (1,11):
print(a, “x”,i,” = ” . a*i)
OUTPUT-
[10] Program in python to check the inputted number is
ARMSTRONG number or not
CODE:
num=int(input(“enter a three digit number”))
f=num
order=len(str(num))
sum=0
while (f>0):
a=f %10
f=int(f/10)
sum=sum+(a**order)
if(sum==num):
print(num,“is an Armstrong number”)
else:
print(num,”is not Armstrong”)
OUTPUT-
[10] Program in python to print total number of vowels in an
inputted string
CODE:
str1=int(input(“enter your own string”))
vowels=0
for i in str1:
if (i==‘a’ or i==‘e’ or i==‘i’ or i==‘o’ or i==‘u’ or i==‘A’ or i==‘E’
or i==‘I’ or i==‘O’ or i==‘U’):
vowels=vowels+1
print(“total number of vowels in this string =”vowels)
OUTPUT-
[12] Program in python to print characters of a string in form
of dictionary
CODE:
int_str=int(input(“enter a string”))
out={x:int_str.count(x) for x in set (int_str)}
print (“occurrence of all characters in”, int_str,“is :\n”+str(out)
OUTPUT-
[13] Program in python to check the number entered is even
or odd
CODE:
a=int(input(“enter a number =”))
if a%2==0:
print(“the number is even”)
else:
print(“the number is odd”)
OUTPUT-
[14] Program in python to calculate area and circumference of
circle, square.
CODE:
def area_of_circle(radius):
area=(22/7)*radius**2
print ("area of CIRCLE is : ",area)
def area_of_rectangle (length, width) :
area = Iength*width
print ("area of rectangle is : ",area)
def area_of_square(side):
area=side**2
print(“area of square is :”,area)
OUTPUT-
[15] Program in python to find second largest
number inputted by user
CODE:
Numlist=[]
Number=int(input(“please enter total number of list elements”))
for i in range (1,Numer+1):
value= int(input(“please enter the value of %d element:”))
numlist.append(value)
numlist.sort()
print(“the second largest element in this list is :”numlis”[number-
2])
OUTPUT-
[16 ] Program in python to print below pattern
CODE:
For i in range (8,0,-1):
For j in range (1,i):
Print(“*”,end= “ “)
Print()
OUTPUT-
[17] Program in python to print the below pattern
CODE:
Num=for i in range (1,9):
For j in range (1,i+1):
Print(num,end= “ “)
Print()
[19] Program in python to print the below pattern
CODE:
for i in range (0,5):
for j in range (0,5):
print(“5”,end= “ “)
print()
[20] Program in python to check an number inputted by user
is palindrome or not
CODE:
Number=int(input(“please enter any number”))
Reverse=0
Temp=number
While (temp>0):
Reminder=temp % 10
Reverse=(reverse * 10)+ Reminder
Print(“reverse of a palindrome number is %d”%revers)
if(number ==reverse):
print(“%d is a palindrome number” %number)
else:
print(“%d is not a palindrome number”%number)