Skip to main content

Posts

Showing posts from June, 2020

15. Program to roll a dice and get number

#Program to roll the dice while True:     import random     print('this is a program to calculate a dice')     print('press enter ')     input()     n=random.randint(1,6)     if n==1:           print('[====================]')           print('[                                               ]')           print('[          o                                       ]')           print('[                                                    ]')           print('[====================]')                if(n==2):                              print('[====================]')          print('[                                             ]')          print('[   o                  2              o    ]')          print('[                                             ]')          print('[====================]')               if(n==3):           print('[====================]')           print('[ 

14. Program to find the square and find whether it is a perfect square

# Program to find and check the perfect square b=0 def square(digit):     while True:         for i in range(0,int(digit/2)):             b=i*i             if(b==digit):                 return(i)         if(b!=digit):            return(-555)y number=int(input('enter the number to be find perfect square root ')) a=square(number) if(number==a*a):     print(number,' is a perfect square')     print('the square root of',number,'is',a) else:     print('Since!',number,'is not a perfect square of any number ')     print('sorry! ',number,'does not have  perfect square root')

13. Program to calculate for BINOMIAL SERIES and MID TERM

#Program to calculate binomial series and middle term import math check=int(input(''' Please choose 1. For middle term 2. For binomial theorem''')) #This is for finding the factorial for combination def factorial(number):     c=1     if(number==0):         return 1     for i in range(number,0,-1):         c=c*i     return c def combination(p,q):     if(p>=q):                  return factorial(p)/(factorial(q)*factorial(p-q))     else:         print('you have written n less which is incorrect') def midtermfind(limit,termid):     print('Program to find the answer by binomial series ')     print('series is in the sequence (a+b) to the power n')     a=int(input('enter a of the formula'))     b=int(input('enter b of the formula'))     result=0          comb=combination(int(limit),int(termid))     result=result+(comb*math.pow(a,(limit-termid))*math.pow(b,termid))     print('The mid term  is =',int(result))      def bi

12. Program to calculate the TRIGONOMETRIC PROBLEMS

#Program to calculate the trigonometric calculations import math print('Program to calculate the formula based trigonometric questions such as tan(A-B)') a=float(input('Please enter A of formula')) b=float(input('Please enter B of formula')) c=(22/(7*180))*a #as pie=22/7 d=(22/(7*180))*b tana=math.tan(c) tanb=math.tan(d) print('The value of tanA is :',tana) print('The value of tanB is ',tanb) print(''' Press   1 for      tan(A-B)  and     2 for      tan(A+b)''') choice=int(input('Press the suitable key for the question')) if(choice==1):     p=(tana-tanb)/(1+tana*tanb)     print('The value for tan(',a,'-',b,') is',p) elif(choice==2):     p=(tana+tanb)/1-(tana*tanb)     print('The value for tan(',a,'+',b,') is',p)