Posts

How to find the square root in python

  Python program to find the square root In this program,you  will about the python program how to find the square root of any number by two method: By using exponent function  By using the cmath module.  For understand the program you have the knowledge: Python input,output. Python data types. Python operators. Example for square root of positive number Code:     # Python Program to calculate the square root for positive number number = 10 number_sqrt = number ** 0.5 print ( 'square root %0.3f is %0.3f' %(number ,number_sqrt)) Output:     square root 10.000 is 3.162 In the above program,value is store in the number variable and then exponent with help ** operator  with power 0.5(½) store in the number_sqrt variable.At the end of the program,display with  help of print function. Example for For real and complex number: Source code: `         import cmath   number = 2 + 2j   number_sqrt = cmath.sqrt(number) print ( 'square root  {0} = {1:0.3f}+{2:0.3f}j'   . format (num

How to add number in python

  Add number in Python To  understand how to add the two number in the python ,first of all you have know how to take input  in python and display output in python . Add the two number Following is the example code for add the two in python: # the following code  adds two numbers by assigning value to variables   number1 = 7 number2 = 4.7   # Add two numbers sum = number1 + number2   # Now Display the sum print ( 'The sum of {0} and {1} is {2}' . format (number1, number2, sum))     Now we will see how add numbers with the help of taking input from the user. Example code: Add the two number by user input    # the following code  taking two number from the user then  add into the sum variable.   number1 = input ( 'Enter first number: ' ) number2 = input ( 'Enter second number: ' )   # Add two numbers sum = float (number1) + float (number2)   # Now Display the sum print ( 'The sum of {0} and {1} is {2}' . format (number1, number2, sum))     In the above exa

Python program to print Hello wolrd

  How to print Hello world! In the python This program is very simple, It is usually used to illustrate the syntax of the specific programming language. To understand this program you have the knowledge of the python basic function of python. Source Code # python program print hello world print('Hello, world!') Output Hello, world! In the above example, we use the built-in print function of python. The string is the sequence of the character, In the python string enclosed in the single ‘’, double” “,  and triple  quotes 

code of Game of Chance

   A Game of Chance One of the most popular games o in casinos and back alleys triangular  games of chance is a dice game known as “craps,”  It is played in hack alleys throughout the world.  Following are rules of the Game: roll two dice. Each die has six faces. These faces contain one, two, three, four, five, and six spots.  the dice  to rest, the sum of the spots on the two upward faces is calculate. If sum is 7 or 11 on the first throw, the player wins.  If the sum is two, three, or twelve on the first throw Called "craps"),  the player loses (mean the "house" wins).  If the sum is four, five, six, eighth, nine, or ten on the first throw, then that sum becomes the player's "point.”  To win, you must continue rolling the dice until you make your points. The player loses by rolling a 7 before making the point.  Code of the game:   #include<stdio.h>  #include<stdlib.h>   #include<time.h>  /*contains prototype for function time */ enum St

How to use radial gradient in css

 CSS radial gradient Radial gradients define the centre and the color transition outward from the center. The minimum color for making radial gradients is two. What is the syntax of radial gradient? The syntax of radial gradient is : radial-gradient(first color name,second color name,so on); What is an example of radial gradient? Example: Can we give a percentage in the radial gradient?  yes we can give a percentage of the color ingredient and the syntax of giving percentage user color is that: radial-gradient(first color name 80%,second color name20%,so on); Example: Can we remove the default shape of the radial gradient?  yes we can change the default shape of the radial gradient, the default is shape is elliptical Writing following syntax for changing the default shape. . radial-gradient(circle at center , color name ,second color name); .Example: We can also change the position of the circle writing position alo

How to use css margin

Image
  What is CSS margin? The gap between any elements of the web pages is known as margin.  there is 3 type of margins left margin right margin-top margin and bottom margin. why we use a margin on web pages?  All the website on the internet design by the CSS and any gap between any elements or defining the position of the element on the webpage we use Margin in the CSS. sometimes we use texts or images on the web pages that look beautiful at a certain position and the distance between the other elements. In the maximum time gap between the elements outer gaps. we are just with the help of margin as compared to position or padding in CSS. How we remove the default margin on the web page? we can remove the default margin by applying the following CSS code. *{ margin :0; } What are different ways of giving margin in CSS?  There are different ways of giving margin in CSS. Manually write:   P{ magin-left:30px; magin-right:30px; magin-bottom:30px; magin-top:30px; } Shortcut of giving margin va